-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix expression inlining when working with macros #853
Merged
TristonianJones
merged 10 commits into
google:master
from
TristonianJones:inline-nested-macros
Nov 10, 2023
Merged
Fix expression inlining when working with macros #853
TristonianJones
merged 10 commits into
google:master
from
TristonianJones:inline-nested-macros
Nov 10, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l46kok
reviewed
Nov 7, 2023
PTAL @l46kok |
l46kok
reviewed
Nov 8, 2023
jnthntatum
approved these changes
Nov 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix expression inlining when working with macros
Inlining was only correctly accounting for situations when the expression to be
inlined did not contain any macros. Once macros were introduced, the identifier
references as well as the macro 'pointer' concept were not correctly being
propagated during inlining.
To preserve the 'pointer' concept, macro expression sub-graphs need to be
deleted when updating macro references. In the prior version of this code,
the sub-graphs were being preserved in the macro call metadata which resulted
in issues with round-tripping the expressions to a string, even though the logic
within the core AST was correct.
There are a few places in the code where expression IDs are being massaged in
order to account for lining up the id space between expressions and then for
propagating id changes down through macros. If there are ways to improve /
consolidate this logic in the future, then this is likely an area worth investing in.