-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
feat(traverse): add generate_uid_in_current_hoist_scope
method
#7423
feat(traverse): add generate_uid_in_current_hoist_scope
method
#7423
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4911290
to
d1dbaa1
Compare
CodSpeed Performance ReportMerging #7423 will not alter performanceComparing Summary
|
7ca6c06
to
f0fd5d3
Compare
f0fd5d3
to
ea274bc
Compare
2d5d1d3
to
460f0d2
Compare
I've squashed the auto-fix commit and updated conformance results, so can better see what's going on here. Reviewing now... |
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.
Some suggestions:
- Add
current_var_hoisting_scope_id
method toTraverseCtx
too. - Instead of
set_current_scope_id
taking 2 params, add a 2nd functionset_current_hoist_scope_id
instead.
- Only generate calls to
set_current_hoist_scope_id
for the scopes which are "hoist scopes" (functions etc). - This should be faster for the majority of scopes which are not "hoist scopes".
- Rather than all binding creation going via
add_binding
which has the cost of looking up scope flags and a branch, should we havegenerate_uid_in_current_scope
andgenerate_uid_in_current_hoist_scope
?
- When generating a
let
binding, there's no reason to do any work checking flags.
These could be done in follow-up PRs if you prefer.
Longer-term we should probably (as you suggested previously) integrate creating the binding into VarDeclarationsStore::insert_var
and insert_let
. So then those 2 functions will already know what scope the binding should be in, as they know if it's a var
or let
.
Yes, we even do not need to pass |
Oh yes! I didn't even think of that. |
Haha. I am trying to avoid adding new APIs (because we have many generate binding APIs), but it is worth doing it. |
We have no real case that needs to be inserted to var hoisting scope id manually, so I think it doesn't need to be added to |
We currently alias all methods of |
generate_uid_in_current_hoist_scope
method
460f0d2
to
69da6fc
Compare
|
67e0d9c
to
2ee960a
Compare
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.
I pushed a few commits. Just nits, really.
Merging this now. @Dunqing if you don't like any of my changes, feel free to alter them in follow-ups.
Merge activity
|
Add an API to handle variable hoisting.
6adfb7f
to
e8c99bb
Compare
Add an API to handle variable hoisting.
e8c99bb
to
9c9deae
Compare
Add an API to handle variable hoisting.