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
spec: disable await binding identifier within static block #12661
spec: disable await binding identifier within static block #12661
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/39150/ |
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 245b35d:
|
bd16c63
to
8fed4f4
Compare
|
||
C = class { static { function f(x = await) {} } }; | ||
|
||
C = class { static { function f({ [await]: x }) {} } }; |
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.
Cases that await
as binding will not throw.
|
||
C = class { static { function await() {} } }; | ||
|
||
C = class { static { await: 0 } }; |
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.
New behaviour: cases that await
as binding throws.
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.
Q: How is the context inside of a static block different from the one inside a static field?
Compared to static field (initializer), the static block further blocks |
9553472
to
4ddaabb
Compare
The CI error is fixed in #12716. I will rebase once that one is merged. |
1cb34f5
to
e698486
Compare
Before merging this PR, please review #12716 first. 🙏 |
e698486
to
245b35d
Compare
This PR forbids
await
binding within the static blocks. The logic ofarguments
check is extended forawait
binding.Since
async (x = class { static { await; } }) => {}
is no longer valid, I also removed the expression scope creation for class static block, sinceAwaitBindingIdentifierInStaticBlock
would be thrown in this case.