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

Parse child of mispelled await expression as if it was inside async #498

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

keyehzy
Copy link
Contributor

@keyehzy keyehzy commented Nov 8, 2021

Right now quick-lint-js for the following code

let f = await () => { 
  await g(); 
};

correctly detects the intention of user to use async instead of await but throw another error for await expression inside the arrow function. This PR fix this by parsing the subsequent expression as a async expression if we detect such intention.

This PR should also fix #278.

If we detect that `await` is followed by an arrow function early inside
`is_identifier` function we can avoid treating `await` as an identifier
and correctly identify that the intention of the user was to use `async`.
We detect that the intention of the user was to use `async` and parse
its child as if so.
@keyehzy
Copy link
Contributor Author

keyehzy commented Nov 8, 2021

Not sure why dnf doesn't like, welp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7$: Improve error message for 'await () => {}'
1 participant