| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index b54172f72c21cc6ccf320ed04877227804a5d134..12547f05d8decdd04f19d60d2a2763ec7752def4 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -2532,6 +2532,7 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
|
|
|
| Expression* pattern;
|
| {
|
| + int decl_pos = peek_position();
|
| ExpressionClassifier pattern_classifier;
|
| Token::Value next = peek();
|
| pattern = ParsePrimaryExpression(&pattern_classifier, ok);
|
| @@ -2547,6 +2548,20 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
|
| *ok = false;
|
| return;
|
| }
|
| +
|
| + is_for_iteration_variable =
|
| + var_context == kForStatement &&
|
| + (peek() == Token::IN || PeekContextualKeyword(CStrVector("of")));
|
| +
|
| + if (!is_for_iteration_variable &&
|
| + (pattern->IsObjectLiteral() || pattern->IsArrayLiteral()) &&
|
| + peek() != Token::ASSIGN) {
|
| + ReportMessageAt(
|
| + Scanner::Location(decl_pos, scanner()->location().end_pos),
|
| + MessageTemplate::kInvalidDestructuringDeclaration);
|
| + *ok = false;
|
| + return;
|
| + }
|
| }
|
|
|
| Scanner::Location variable_loc = scanner()->location();
|
|
|