Skip to content
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

allowAwaitOutsideFunction parser option #7634

Closed
jdalton opened this issue Mar 27, 2018 · 8 comments
Closed

allowAwaitOutsideFunction parser option #7634

jdalton opened this issue Mar 27, 2018 · 8 comments
Labels
i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser

Comments

@jdalton
Copy link
Member

jdalton commented Mar 27, 2018

Just as there's a loose mode to allow top-level return it would be nice to have some kind of loose mode, allowAwaitEverywhere, or allowAwaitOutsideFunction option for top-level await.

@nicolo-ribaudo
Copy link
Member

What would it be used to? I'd suggest wrapping your code in an async function before parsing it.

@jdalton
Copy link
Member Author

jdalton commented Mar 27, 2018

There is now environments like REPLs which support top-level await.
Being able to parse it would be great.

@hzoo
Copy link
Member

hzoo commented Mar 27, 2018

Sounds fine to me, if someone wants to PR it

@jdalton
Copy link
Member Author

jdalton commented Mar 27, 2018

🤘 Do you have an option name preference?

@hzoo
Copy link
Member

hzoo commented Mar 27, 2018

Any of those work, open to ideas:

allowAwaitEverywhere
allowAwaitOutsideFunction
allowTopLevelAwait?

@jdalton
Copy link
Member Author

jdalton commented Mar 27, 2018

Ok. I can prep a PR 😋

Update:

WIP PR opened at #7637.

@jdalton jdalton changed the title Loose mode for top-level await. allowAwaitOutsideFunction parser option Mar 28, 2018
@hzoo
Copy link
Member

hzoo commented Mar 28, 2018

Found some related issues as reference

#6703
#6720
#6671 (by @nicolo-ribaudo)

@nicolo-ribaudo
Copy link
Member

Implemented in #7637

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 3, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser
Projects
None yet
Development

No branches or pull requests

3 participants