Add options.allowAwaitOutsideFunction.#7637
Add options.allowAwaitOutsideFunction.#7637hzoo merged 1 commit intobabel:masterfrom jdalton:allowAwaitOutsideFunction
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. |
xtuc
left a comment
There was a problem hiding this comment.
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.