spec: disable await binding identifier within static block#12661
spec: disable await binding identifier within static block#12661nicolo-ribaudo merged 2 commits intobabel:mainfrom
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.
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.
New behaviour: cases that await as binding throws.
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
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
awaitbinding within the static blocks. The logic ofargumentscheck is extended forawaitbinding.Since
async (x = class { static { await; } }) => {}is no longer valid, I also removed the expression scope creation for class static block, sinceAwaitBindingIdentifierInStaticBlockwould be thrown in this case.