-
-
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
Add options.allowAwaitOutsideFunction. #7637
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7405/ |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7396/ |
WDYT of naming it Also, I think that this code should still throw: function fn() {
await x;
} |
Fixed lint errors, added tests, and ensured an error is thrown for the case raised by @nicolo-ribaudo. |
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 your.
Could we maybe rename the tests? core/uncategorised/555
is not super obvious.
I wasn't sure about that but noticed a large collection of tests incremented as numbers. Is there a particular place or naming scheme you had in mind? |
You could put it in
I still prefer the |
I just learned that this is actually a new proposal (https://github.com/MylesBorins/proposal-top-level-await). Can you define this feture it using a new Babylon plugin ( Something like this: if (isAwait && !this.state.inFunction) this.expectPlugin("topLevelAwait"); The tests would then go in |
I rather not since the proposal, and its variations, are much more involved. I think later, if someone wants to add a plugin to support the proposal (and variations) more in-depth, then they could build on top of Update: Moved tests to a more readable place. |
that's true |
This PR addresses #7634.
It's missing tests as the moment. (I'll rebase them in soon)Update:
✅ Added tests.