Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index 9809071d4789a58da84abfd32420688e0fd2a038..7871ab01483c9b602ae6f9fd90afb9315a7b61a1 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -4996,6 +4996,12 @@ ParserBase<Impl>::ParseExpressionOrLabelledStatement( |
ReportUnexpectedToken(Next()); |
*ok = false; |
return impl()->NullStatement(); |
+ case Token::LET: |
+ if (PeekAhead() != Token::LBRACK) break; |
+ impl()->ReportMessageAt(scanner()->peek_location(), |
+ MessageTemplate::kUnexpectedTokenLetLBrack); |
+ *ok = false; |
+ return impl()->NullStatement(); |
default: |
break; |
} |
@@ -5446,6 +5452,13 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement( |
StatementT init = impl()->NullStatement(); |
+ // "let [" is forbidden in the initializer of the for loop. |
+ if (peek() == Token::LET && PeekAhead() == Token::LBRACK) { |
+ impl()->ReportMessageAt(scanner()->peek_location(), |
+ MessageTemplate::kUnexpectedTokenLetLBrack); |
+ *ok = false; |
+ return init; |
+ } |
Dan Ehrenberg
2017/02/13 19:26:57
I'm not sure I agree with your reading of the spec
vabr (Chromium)
2017/02/13 20:14:46
The test failures are due to not restricting this
vabr (Chromium)
2017/02/13 20:29:20
Hm, now I see how I misunderstood your comment and
|
if (peek() == Token::VAR || peek() == Token::CONST || |
(peek() == Token::LET && IsNextLetKeyword())) { |
// The initializer contains declarations. |