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

let default results in keyword let being reported as reserved #313

Closed
robertrossmann opened this issue Jan 17, 2017 · 6 comments
Closed

Comments

@robertrossmann
Copy link

The following code:

espree.parse('let default = true', { ecmaVersion: 6, sourceType: 'module' })

Results in the following error: SyntaxError: The keyword 'let' is reserved

Expected behaviour: I would have expected to see the default being reported as reserved keyword, not let.

When sourceType: 'script' or when I use const or var instead of let, the error seems to match my expectations by reporting the following: SyntaxError: Unexpected token default

@ilyavolodin
Copy link
Member

What version of Espree are you using? This has been fixed a long time ago. Here's the related issue: #149

@not-an-aardvark
Copy link
Member

@ilyavolodin I think #149 might be a different issue. let default = 0 is invalid syntax -- the issue here is that the error message is wrong (it complains about let instead of default).

@robertrossmann
Copy link
Author

I have 3.3.2 installed. Looks like that's the latest.

@ilyavolodin
Copy link
Member

ilyavolodin commented Jan 17, 2017

Ah, sorry, @not-an-aardvark is correct. I misread the issue. I think this would be an issue upstream in Acorn.
Edit: Verified in https://astexplorer.net/ that it's an issue with Acorn. Esprima handles this issue correctly. @Alaneor could you file an issue in https://github.com/ternjs/acorn repository for this?

@robertrossmann
Copy link
Author

Opened a new issue in Acorn repo: acornjs/acorn#544 🎉

Feel free to close this unless you would like to keep track of this. Thanks!

@kaicataldo
Copy link
Member

Closing this as it looks like this was fixed upstream.

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

No branches or pull requests

5 participants