Skip to content

Conversation

@ZachSierp
Copy link
Contributor

Populate the macroCalls map in sourceInfo with macro expressions while parsing. For macro expressions nested in other macros, the map stores the argument ID of the nested macro for self reference instead of the full expression.

Storing the ID instead of the full argument reduces expression duplication in macroCalls and reduces overall size.

While iterating the AST, expression IDs can be looked up in macroCalls and continue from there. Nested macros can also be looked up by ID while iterating a macro in macroCalls.

This change covers cases where a macro is the target so some other macro such as has(a.b).filter(x, x > 0), and cases where macros are nested inside the arguments of subexpressions like x.filter(y, y.exists(z, has(z.a)) && y.exists(z, has(z.b)))

Fixes issue #292

@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones TristonianJones merged commit 9630e6c into google:master Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants