Skip to content

Commit

Permalink
math: add kwarg_or helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei8l committed Oct 21, 2024
1 parent 9fef886 commit cb3c96c
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 152 deletions.
4 changes: 2 additions & 2 deletions src/math_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ constexpr void _validate_operand( thingie const &thing, std::string_view symbol

void _validate_unused_kwargs( diag_kwargs const &kwargs )
{
for( diag_kwargs::value_type const &v : kwargs ) {
for( diag_kwargs::impl_t::value_type const &v : kwargs.kwargs ) {
if( !v.second.was_used() ) {
throw std::invalid_argument( string_format( R"(Unused kwarg "%s")", v.first ) );
}
Expand Down Expand Up @@ -601,7 +601,7 @@ void math_exp::math_exp_impl::new_func()
"All positional arguments must precede keyword-value pairs" );
}
kwarg &kw = std::get<kwarg>( output.top().data );
kwargs.emplace( kw.key, _get_diag_value( *kw.val ) );
kwargs.kwargs.emplace( kw.key, _get_diag_value( *kw.val ) );
output.pop();
}
for( std::vector<thingie>::size_type i = 0; i < nparams; i++ ) {
Expand Down
Loading

0 comments on commit cb3c96c

Please sign in to comment.