-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
"await is only valid in async function" when trying to use await in a for loop with TLA support #32708
Comments
I think the issue is due to a premature error check that runs before the code block is allowed to be closed.
It should work as expected. |
@hassaanp yeah I've also just discovered it while trying to reproduce. Do you consider this a bug? |
@hassaanp actually it can be that it's not only repl issue, this is the example that doesn't use repl and still fails (both with for...of loop written with 1 and 3 lines):
|
I don't believe this is a bug. From what I understand, repl behavior is configured by the I could be wrong. Maybe other contributors can chip in. |
@hassaanp yeah but also |
There is more general work to move towards a new method of evaluating repl input (using v8 inspector apis), which would fix a number of things, including handling TLA. because of that, i don't think anyone is specifically working on making our acorn parser hacks work better. |
@devsnek is there an open issue on it? if so, I'd rather close this as part of it and subscribe to it instead |
This is working in newer Node.js versions. Closing. |
What steps will reproduce the bug?
I run
node
with TLA support flag, I don't get the error if I doawait
on a top-level, but I do get the error if I do it in afor
loop.How often does it reproduce? Is there a required condition?
What is the expected behavior?
No error.
What do you see instead?
Error, see above.
Additional information
The text was updated successfully, but these errors were encountered: