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

[[...[], 0].x] = [0] should not be a syntax error #1015

Closed
evanw opened this issue Feb 18, 2021 · 1 comment
Closed

[[...[], 0].x] = [0] should not be a syntax error #1015

evanw opened this issue Feb 18, 2021 · 1 comment

Comments

@evanw
Copy link

evanw commented Feb 18, 2021

I'm the author of esbuild and someone filed a correctness bug against my JavaScript parser: evanw/esbuild#835. Turns out acorn has the same issue, so I'm filing this here too.

Repro with acorn v8.0.5:

eval('[[...[], 0].x] = [0]') // this works fine without an error
require('acorn').parse('[[...[], 0].x] = [0]', { ecmaVersion: 'latest' }) // this throws an error

Running this code gives SyntaxError: Comma is not permitted after the rest element which is unexpected.

@marijnh
Copy link
Member

marijnh commented Feb 22, 2021

Thanks for reporting that. Attached patch should help with this.

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

2 participants