Skip to content

Commit 7154276

Browse files
committed
Workaround cppcheck AST parser bug
1 parent e4a1d5f commit 7154276

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

tinyexpr.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,38 +2384,36 @@ te_type te_parser::te_eval(const te_expr* texp)
23842384
[&, texp]<typename T0>(const T0& var) -> te_type
23852385
{
23862386
using T = std::decay_t<T0>;
2387-
// cppcheck-suppress-begin internalAstError
23882387
if constexpr (te_is_constant_v<T>)
23892388
{
23902389
return var;
23912390
}
2392-
if constexpr (te_is_variable_v<T>)
2391+
else if constexpr (te_is_variable_v<T>)
23932392
{
23942393
return *var;
23952394
}
2396-
if constexpr (std::is_same_v<T, te_fun0>)
2395+
else if constexpr (std::is_same_v<T, te_fun0>)
23972396
{
23982397
return var();
23992398
}
2400-
if constexpr (std::is_same_v<T, te_confun0>)
2399+
else if constexpr (std::is_same_v<T, te_confun0>)
24012400
{
24022401
return var(texp->m_parameters[0]);
24032402
}
2404-
if constexpr (te_is_closure_v<T>)
2403+
else if constexpr (te_is_closure_v<T>)
24052404
{
24062405
constexpr size_t n_args = te_function_arity<T>;
24072406
static_assert(n_args > 0);
24082407
return std::apply(var,
24092408
make_closure_arg_list(M, texp->m_parameters[n_args - 1],
24102409
std::make_index_sequence<n_args - 1>{}));
24112410
}
2412-
if constexpr (te_is_function_v<T>)
2411+
else if constexpr (te_is_function_v<T>)
24132412
{
24142413
constexpr size_t n_args = te_function_arity<T>;
24152414
return std::apply(var,
24162415
make_function_arg_list(M, std::make_index_sequence<n_args>{}));
24172416
}
2418-
// cppcheck-suppress-end internalAstError
24192417
return te_nan;
24202418
},
24212419
texp->m_value);

0 commit comments

Comments
 (0)