Index: src/parsing/parser.cc |
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
index 0048b8da698b718cc01671f52ab659b905427c2e..f5a95acd19907a8a54cf3e12a6aaca1a7543b086 100644 |
--- a/src/parsing/parser.cc |
+++ b/src/parsing/parser.cc |
@@ -3676,7 +3676,15 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, |
factory()->NewForEachStatement(mode, labels, stmt_pos); |
Target target(&this->target_stack_, loop); |
- Expression* enumerable = ParseExpression(true, CHECK_OK); |
+ Expression* enumerable; |
+ if (mode == ForEachStatement::ITERATE) { |
+ ExpressionClassifier classifier; |
+ enumerable = ParseAssignmentExpression(true, &classifier, CHECK_OK); |
+ enumerable = ParserTraits::RewriteNonPattern(enumerable, &classifier, |
+ CHECK_OK); |
+ } else { |
+ enumerable = ParseExpression(true, CHECK_OK); |
+ } |
Expect(Token::RPAREN, CHECK_OK); |
@@ -3791,7 +3799,16 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, |
factory()->NewForEachStatement(mode, labels, stmt_pos); |
Target target(&this->target_stack_, loop); |
- Expression* enumerable = ParseExpression(true, CHECK_OK); |
+ Expression* enumerable; |
+ if (mode == ForEachStatement::ITERATE) { |
+ ExpressionClassifier classifier; |
+ enumerable = ParseAssignmentExpression(true, &classifier, CHECK_OK); |
+ enumerable = ParserTraits::RewriteNonPattern(enumerable, &classifier, |
+ CHECK_OK); |
+ } else { |
+ enumerable = ParseExpression(true, CHECK_OK); |
+ } |
+ |
Expect(Token::RPAREN, CHECK_OK); |
// Make a block around the statement in case a lexical binding |