-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: support mutated outer decorated class binding #16387
Conversation
@@ -0,0 +1,145 @@ | |||
{ |
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.
This test is disabled due to #16386.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/56585 |
t.variableDeclarator(t.cloneNode(classOuterBindingLocal)), | ||
t.variableDeclarator(classOuterBindingDelegateLocal), | ||
]), | ||
t.blockStatement([ |
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.
We use a block statement to simulate the inner scope so that it can inherit the Yield
and Await
production parameter.
@capture(() => K) | ||
@assertUninitialized(() => K) | ||
class K { | ||
//todo: add the assertUninitialized decorator when we properly implement class tdz |
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.
Could you for now assert that we throw the TDZ error, so that when we fix it we don't forget to update the test?
In this PR we generate an dedicated scope for a decorated class when its outer class binding will be mutated, because the class method, decorators and computed keys may still refer to the internal class binding.
This PR does not improve current class tdz check.