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

ForOfStatement#right should disallow SequenceExpression #642

Closed
mysticatea opened this issue Dec 22, 2017 · 1 comment
Closed

ForOfStatement#right should disallow SequenceExpression #642

mysticatea opened this issue Dec 22, 2017 · 1 comment

Comments

@mysticatea
Copy link
Contributor

I expected the following code to throw a syntax error, but not: http://astexplorer.net/#/gist/0c38e7492bcdef3ade0b04fb93f0474d/c8c7a744abbece46d49c172fb6287f0bfa54da2a

for (const a in b, c); // OK. ForInStatement#right is Expression production which contains comma operator.
for (const a of b, c); // ERROR. ForOfStatement#right is AssignmentExpression production which doesn't contain comma operator.

IterationExpression
  for ( ForDeclaration in Expression ) Statement
  for ( ForDeclaration of AssignmentExpression ) Statement

https://www.ecma-international.org/ecma-262/8.0/#prod-IterationStatement

@marijnh
Copy link
Member

marijnh commented Dec 22, 2017

Thanks for pointing that out. Attached patch should help.

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