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
Parse for await (async of ...)
#13244
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45770/ |
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 cc7e470:
|
packages/babel-parser/test/fixtures/core/categorized/for-async-of-dot/input.js
Outdated
Show resolved
Hide resolved
Is there any particular place I should be putting these parser tests? I wasn't sure if I should put them in |
2479882
to
3890721
Compare
@Zalathar The The |
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.
Awesome!
3890721
to
cc7e470
Compare
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 await (async of
by adding lookahead to unary async arrow parsingfor await (async of ...)
This allows the parser to correctly parse
for await (async of []);
by implementing the suggestion given by @JLHwung in #13235 (comment).When the expression parser sees
async of
, it will peek ahead for a=
character before it commits to parsing an async arrow function.On its own this would also cause
for (async of []);
to parse, which is forbidden, so we also add explicit code to thefor
parser to detect and reject for-of statements that begin withasync of
.