diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp index 7f1f51b19..cbecdb4c0 100644 --- a/lib/config/aexpression.cpp +++ b/lib/config/aexpression.cpp @@ -475,7 +475,8 @@ Value AExpression::FunctionWrapper(const std::vector& arguments, const Ar for (int i = 0; i < std::min(arguments.size(), funcargs->GetLength()); i++) locals->Set(funcargs->Get(i), arguments[i]); - return expr->Evaluate(locals); + expr->Evaluate(locals); + return locals->Get("__result"); } Value AExpression::OpFunction(const AExpression* expr, const Dictionary::Ptr& locals) diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 4a56e2005..7e3f520b6 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -781,8 +781,12 @@ rterm: T_STRING arr->Add(Empty); - arr->Add(*$4); + Array::Ptr arrex = make_shared(); + arrex->Add(make_shared(&AExpression::OpSet, make_shared(&AExpression::OpLiteral, "__result", @4), *$4, @4)); delete $4; + AExpression::Ptr aexpr = make_shared(&AExpression::OpDict, arrex, true, @4); + + arr->Add(aexpr); $$ = new Value(make_shared(&AExpression::OpFunction, arr, Array::Ptr($2), DebugInfoRange(@1, @4))); }