Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index b6458a1ea271c39b9136e7496683a8f5396fdaa8..fb9567621f2510e77a7da24f140b78146d3df2e9 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -4950,12 +4950,19 @@ ParserBase<Impl>::ParseExpressionOrLabelledStatement( |
ReportUnexpectedToken(Next()); |
*ok = false; |
return impl()->NullStatement(); |
- case Token::LET: |
- if (PeekAhead() != Token::LBRACK) break; |
+ case Token::LET: { |
+ Token::Value next_next = PeekAhead(); |
+ // "let" followed by either "[", "{" or an identifier means a lexical |
+ // declaration, which should not appear here. |
+ if (next_next != Token::LBRACK && next_next != Token::LBRACE && |
+ next_next != Token::IDENTIFIER) { |
+ break; |
+ } |
impl()->ReportMessageAt(scanner()->peek_location(), |
MessageTemplate::kUnexpectedLexicalDeclaration); |
*ok = false; |
return impl()->NullStatement(); |
+ } |
default: |
break; |
} |