File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -613,6 +613,7 @@ private CelExpr buildMacroCallArgs(CelExpr expr) {
613613 // means that the depth check on the AST during parsing will catch recursion overflows
614614 // before we get to here.
615615 expr .call ().args ().forEach (arg -> callExpr .addArgs (buildMacroCallArgs (arg )));
616+ expr .call ().target ().ifPresent (target -> callExpr .setTarget (buildMacroCallArgs (target )));
616617 return resultExpr .setCall (callExpr .build ()).build ();
617618 }
618619 return expr ;
Original file line number Diff line number Diff line change @@ -273,4 +273,18 @@ public void unparse_comprehensionWithoutMacroCallTracking_throwsException() thro
273273 "Comprehension unparsing requires macro calls to be populated. Ensure the option is"
274274 + " enabled." );
275275 }
276+
277+ @ Test
278+ public void unparse_macroWithReceiverStyleArg () throws Exception {
279+ CelParser parser =
280+ CelParserImpl .newBuilder ()
281+ .setOptions (CelOptions .newBuilder ().populateMacroCalls (true ).build ())
282+ .setStandardMacros (CelStandardMacro .STANDARD_MACROS )
283+ .build ();
284+ CelAbstractSyntaxTree ast =
285+ parser .parse ("[\" a\" ].all(x, x.trim().lowerAscii().contains(\" b\" ))" ).getAst ();
286+
287+ assertThat (unparser .unparse (ast ))
288+ .isEqualTo ("[\" a\" ].all(x, x.trim().lowerAscii().contains(\" b\" ))" );
289+ }
276290}
You can’t perform that action at this time.
0 commit comments