Skip to content
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

Added registerReplacement to ScopedWalker #1403

Merged
merged 2 commits into from
Jan 10, 2024
Merged

Conversation

oxisto
Copy link
Member

@oxisto oxisto commented Jan 2, 2024

In some frontends (e.g., the Go frontend) we are replacing certain nodes in an extra pass, while iterating with the ScopedWalker. One such usecase is to replace calls with casts. Previously, when doing so, chained replacement of calls were a problem, since the original replaced value was stil registered in the walker and was used to determine further AST children to "walk" on, instead of the new node.

This adds a function to register such replacements with the walker.

In some frontends (e.g., the Go frontend) we are replacing certain nodes in an extra pass, while iterating with the `ScopedWalker`. One such usecase is to replace calls with casts. Previously, when doing so, chained replacement of calls were a problem, since the original replaced value was stil registered in the walker and was used to determine further AST children to "walk" on, instead of the new node.

This adds a function to register such replacements with the walker.
@oxisto oxisto requested a review from konradweiss as a code owner January 2, 2024 11:43
@oxisto oxisto requested a review from KuechA January 2, 2024 11:43
Copy link
Collaborator

@konradweiss konradweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@oxisto oxisto enabled auto-merge (squash) January 10, 2024 08:14
Copy link

sonarcloud bot commented Jan 10, 2024

@oxisto oxisto merged commit 360186c into main Jan 10, 2024
4 checks passed
@oxisto oxisto deleted the replacement-graph-walker branch January 10, 2024 08:16
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