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

Should throw on for (async of []); #190

Open
fisker opened this issue Apr 29, 2021 · 5 comments
Open

Should throw on for (async of []); #190

fisker opened this issue Apr 29, 2021 · 5 comments

Comments

@fisker
Copy link
Collaborator

fisker commented Apr 29, 2021

Babel PR babel/babel#13208
Prettier issue prettier/prettier#10777

@KFlash
Copy link
Contributor

KFlash commented May 24, 2021

@3cp It will be very challenging to fix this without a lookahead ...

@3cp
Copy link
Member

3cp commented May 24, 2021

Then forgot about it 😂

@3cp
Copy link
Member

3cp commented May 24, 2021

undefined is not a keyword which is one of the initial design mistakes of JS.
async is not a keyword because it's an added feature which cannot be made as a keyword without breaking legacy JS code.
JS parser is really not a pleasant artefact to work with. 😂

@KFlash
Copy link
Contributor

KFlash commented May 24, 2021

I think you can throw an error if you pass down an context mask or something. In the future I will figure out how to solve it without a lookahead, but for now this is how I solved it in Kataw.

@KFlash
Copy link
Contributor

KFlash commented May 24, 2021

@3cp It's possible to solve this without a lookahead. Just return the 'async' identifier if you see the 'of' keyword and deal with the rest of the logic in 'parseForStatement'. Very easy to solve 👍

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

No branches or pull requests

3 participants