| Index: src/preparser.cc
|
| diff --git a/src/preparser.cc b/src/preparser.cc
|
| index 828177aee0a696ddf51c75b2ca7867aacc163522..3268e3c508bc2fb6887564b5d03e5675c2f46d2a 100644
|
| --- a/src/preparser.cc
|
| +++ b/src/preparser.cc
|
| @@ -659,10 +659,9 @@ PreParser::Statement PreParser::ParseWhileStatement(bool* ok) {
|
| }
|
|
|
|
|
| -bool PreParser::CheckInOrOf() {
|
| +bool PreParser::CheckInOrOf(bool accept_OF) {
|
| if (peek() == i::Token::IN ||
|
| - (allow_for_of() &&
|
| - peek() == i::Token::IDENTIFIER &&
|
| + (allow_for_of() && accept_OF && peek() == i::Token::IDENTIFIER &&
|
| scanner_->is_next_contextual_keyword(v8::internal::CStrVector("of")))) {
|
| Next();
|
| return true;
|
| @@ -685,9 +684,10 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
|
| VariableDeclarationProperties decl_props = kHasNoInitializers;
|
| ParseVariableDeclarations(
|
| kForStatement, &decl_props, &decl_count, CHECK_OK);
|
| - bool accept_IN = decl_count == 1 &&
|
| - !(is_let && decl_props == kHasInitializers);
|
| - if (accept_IN && CheckInOrOf()) {
|
| + bool has_initializers = decl_props == kHasInitializers;
|
| + bool accept_IN = decl_count == 1 && !(is_let && has_initializers);
|
| + bool accept_OF = !has_initializers;
|
| + if (accept_IN && CheckInOrOf(accept_OF)) {
|
| ParseExpression(true, CHECK_OK);
|
| Expect(i::Token::RPAREN, CHECK_OK);
|
|
|
| @@ -695,8 +695,8 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
|
| return Statement::Default();
|
| }
|
| } else {
|
| - ParseExpression(false, CHECK_OK);
|
| - if (CheckInOrOf()) {
|
| + Expression lhs = ParseExpression(false, CHECK_OK);
|
| + if (CheckInOrOf(lhs.IsIdentifier())) {
|
| ParseExpression(true, CHECK_OK);
|
| Expect(i::Token::RPAREN, CHECK_OK);
|
|
|
|
|