-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
Traverse
enter scope after enter_*
, exit before exit_*
#4200
Comments
Currently, I want to use ast-codegen also needs to follow this. @rzvxa cc |
That's a different issue from this. |
Previously we were mostly visiting scope before nodes that's why I made that the default of our generated Rust code. But I have to say it makes more sense to fire off the scope events inside of node events. Does this order work for you: |
Note to self: When making this change to Take care - no tests for scopes in transformer at present, so missing something could silently break things. Probably should rename it |
I'm going to be AFK today(till about 9 PM UTC). Meanwhile, I Didn't want to be a blocker so here we go. It would fix the #4200 merge if you guys find it in the correct order otherwise feel free to close it.
Closes #4200. Align `Traverse`'s behavior with `Visit` and `VisitMut`. For types with scopes, call `enter_*` before entering scope, and call `exit_*` after exiting scope.
Closed in #4684. |
Currently
Traverse
's timing of entering and exiting scopes is different for different node types. It depends on whether the scope covers all fields, or only a subset.enter_*
and exited beforeexit_*
.enter_*
and exited afterexit_*
.This means
enter_*
andexit_*
for any node are always called with same scope at top of the scope stack. Good.But the fact that current scope in
enter_*
andexit_*
is different depending on the node makes it confusing.Change this to be consistent for all node types:
enter_*
.exit_*
.If they need it,
enter_*
/exit_*
can get the node'sScopeId
from the node'sscope_id
field.The text was updated successfully, but these errors were encountered: