-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[Babel 8] Change scope.{references,uids}
to Set
#16624
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
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/59456 |
In fact, there are some potential problems with the current behavior. For example, when calling |
references?: Set<string>; | ||
globals: { [name: string]: t.Identifier | t.JSXIdentifier }; | ||
uids: { [name: string]: boolean }; | ||
uids?: Set<string>; |
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.
Can you add a comment saying that they are only defined in the program scope? Or maybe, we can simplify some methods by defining them in all scopes but using the same shared set.
@liuxingbaoyu Do you still want to do this? (I think we should) |
Yes I will continue it! |
If people miss the changelog from Babel 7 to Babel 8, they would have a confusing debug experience because from their point of view, I suggest we introduce |
Maybe could that getter also return a proxy that makes it work with the underlying set? |
Perhaps we could just rename |
Fixes #1, Fixes #2
In addition to changing
scope.{references,uids}
toSet
, we also only create them at the top-level program scope, since we never use them in child scopes.I'm not sure if these two properties are public, but it would be good to mention it in the migration guide.