Index: src/preparser.cc |
diff --git a/src/preparser.cc b/src/preparser.cc |
index 00332ada0985fdb644f006195d5ffd5f9fdbd30f..94ac6b4844ebf3916bfcfa8645efcdb5a32f8857 100644 |
--- a/src/preparser.cc |
+++ b/src/preparser.cc |
@@ -715,9 +715,14 @@ PreParser::Statement PreParser::ParseWhileStatement(bool* ok) { |
} |
-bool PreParser::CheckInOrOf(bool accept_OF) { |
- if (Check(Token::IN) || |
- (accept_OF && CheckContextualKeyword(CStrVector("of")))) { |
+bool PreParser::CheckInOrOf(bool accept_OF, bool* ok) { |
+ if (Check(Token::IN)) { |
+ if (is_strong(language_mode())) { |
+ ReportMessageAt(scanner()->location(), "strong_for_in"); |
+ *ok = false; |
+ } |
+ return true; |
+ } else if (accept_OF && CheckContextualKeyword(CStrVector("of"))) { |
return true; |
} |
return false; |
@@ -743,22 +748,24 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) { |
bool has_initializers = decl_props == kHasInitializers; |
bool accept_IN = decl_count == 1 && !(is_lexical && has_initializers); |
bool accept_OF = !has_initializers; |
- if (accept_IN && CheckInOrOf(accept_OF)) { |
- ParseExpression(true, CHECK_OK); |
- Expect(Token::RPAREN, CHECK_OK); |
- |
- ParseSubStatement(CHECK_OK); |
+ if (accept_IN && CheckInOrOf(accept_OF, ok)) { |
+ if (*ok) { |
marja
2015/02/19 12:34:22
Nit: I'd write this the same style as Parser, so,
rossberg
2015/02/19 13:23:05
Done.
|
+ ParseExpression(true, CHECK_OK); |
+ Expect(Token::RPAREN, CHECK_OK); |
+ ParseSubStatement(CHECK_OK); |
+ } |
return Statement::Default(); |
} |
} else { |
Expression lhs = ParseExpression(false, CHECK_OK); |
is_let_identifier_expression = |
lhs.IsIdentifier() && lhs.AsIdentifier().IsLet(); |
- if (CheckInOrOf(lhs.IsIdentifier())) { |
- ParseExpression(true, CHECK_OK); |
- Expect(Token::RPAREN, CHECK_OK); |
- |
- ParseSubStatement(CHECK_OK); |
+ if (CheckInOrOf(lhs.IsIdentifier(), ok)) { |
+ if (*ok) { |
+ ParseExpression(true, CHECK_OK); |
+ Expect(Token::RPAREN, CHECK_OK); |
+ ParseSubStatement(CHECK_OK); |
+ } |
return Statement::Default(); |
} |
} |