From: Gunnar Beutner Date: Tue, 1 Dec 2015 15:41:00 +0000 (+0100) Subject: Turn '=>' lambda expressions into side-effect-free statements X-Git-Tag: v2.5.0~676 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=678a237739adbea8ea9a8b11854fc7a147accbd0;p=icinga2 Turn '=>' lambda expressions into side-effect-free statements fixes #10760 --- diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index dc83a242e..e1c3589b0 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -690,27 +690,6 @@ rterm_side_effect: rterm '(' rterm_items ')' $$ = new FunctionCallExpression($1, *$3, @$); delete $3; } - | identifier T_FOLLOWS rterm - { - DictExpression *aexpr = dynamic_cast($3); - if (aexpr) - aexpr->MakeInline(); - - std::vector args; - args.push_back(*$1); - delete $1; - - $$ = new FunctionExpression(args, new std::map(), $3, @$); - } - | '(' identifier_items ')' T_FOLLOWS rterm - { - DictExpression *aexpr = dynamic_cast($5); - if (aexpr) - aexpr->MakeInline(); - - $$ = new FunctionExpression(*$2, new std::map(), $5, @$); - delete $2; - } | T_IF '(' rterm ')' rterm_scope else_if_branches { $5->MakeInline(); @@ -814,6 +793,27 @@ rterm_no_side_effect: T_STRING { $$ = MakeLiteral(@$.FirstLine); } + | identifier T_FOLLOWS rterm + { + DictExpression *aexpr = dynamic_cast($3); + if (aexpr) + aexpr->MakeInline(); + + std::vector args; + args.push_back(*$1); + delete $1; + + $$ = new FunctionExpression(args, new std::map(), $3, @$); + } + | '(' identifier_items ')' T_FOLLOWS rterm + { + DictExpression *aexpr = dynamic_cast($5); + if (aexpr) + aexpr->MakeInline(); + + $$ = new FunctionExpression(*$2, new std::map(), $5, @$); + delete $2; + } | rterm_array | rterm_scope_require_side_effect {