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
Use set in parser scope #13408
Use set in parser scope #13408
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/46611/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 82abbaa:
|
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.
Thanks for going through all these complexity issues.
Just in case this isn't already on your radar @JLHwung, I recently noticed something similar in babel/packages/babel-traverse/src/scope/binding.ts Lines 94 to 101 in b281fe3
(Of course, there it's technically an API change so may not be straightforward to just change, but maybe we can add a secondary set to speed up checking for duplicates while still maintaining the array for compatibility.) |
@motiz88 Thanks. That's a good catch! A secondary set may introduce consistent issues due to multiple truth. We could provide |
This PR is similar to #13406: We use Set for checking duplicate bindings in parser scope.
Benchmark result (baseline is 7.14.4, current is this PR)
Length-1 let declarations