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
Fails to parse 'Spread' syntax: Unexpected token ... #2034
Comments
这么长时间了还没修复! |
Actually, the spread operator seems to be correctly parsed in almost every case (function parameters, array initialization). It is even present in the parseObjectInitializer at line 936 so I think it should be working, but as OP found out, it actually breaks with Unexpected token inside parseObjectPropertyKey. I'm not entirely sure why the parseSpreadElement handled in parseObjectInitializer isn't triggering, but at least with this fix I was able to proceed with parsing of our files. |
The solution from @Jamby93 worked for me. If you want to patch the node_modules source directly without having to compile the source, look for the following line (currently line 2511 in dist/esprima.js):
|
I upgraded bootstrap to V5, suffering the same problem, feeling so bad. |
@jogibear9988 is this supported in https://github.com/node-projects/esprima-next ? |
don't know. test it, if it does not work, create an issue and I will fix |
@Meir017 @GrayYoung |
For anyone else struggling with this, one option is to run Babel on the offending file(s) |
Steps to reproduce
I'm using the ES2018 syntax in my code, and Esprima is failing to parse the "spread" syntax (
...
), for creating iterables and concatenating objects.Expected output
I would expect the Spread syntax to be correctly parsed.
Actual output
Here's a demo link to the current issue being faced
Here's the full stack trace:
Relevant references
You can see the Spread syntax here.
The text was updated successfully, but these errors were encountered: