-
Notifications
You must be signed in to change notification settings - Fork 782
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
Unexected 'Invalid left-hand side in for-in' #1920
Comments
As I understand it, this is because the If the The issue manifests inside the else because the else clause is immediately parsed as a sub-task of the if statement ( I see two possible fixes:
|
…g of resources https://bugs.webkit.org/show_bug.cgi?id=200935 Reviewed by Timothy Hatcher. Address a few Esprima issues: Issue #1991 - Failure to parse template literal with destructuring assignment expression jquery/esprima#1991 Issue #1920 - Invalid Left Hand Side in for-in jquery/esprima#1920 * UserInterface/External/Esprima/esprima.js: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@248923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Esprima throws an error when parsing seemingly correct code with a for-in loop. The error seems to be sensitive to the code surrounding it.
Steps to reproduce
Note that this is a ~minimal reproduction. The actual code that I was trying to parse is http://pagead2.googlesyndication.com/pagead/js/r20180312/r20170110/reactive_library.js
Expected output
I think the AST should be parsed successfully. I don't see anything wrong with the above code. In particular, changing the
f()
call in the first for loop somehow makes the error disappear. Likewise adding curly braces afterelse
also makes the error disappear.Chrome executes the following code just fine:
Actual output
The text was updated successfully, but these errors were encountered: