Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index 126037823439150c746188a24b7c076c3e4cdb5d..a22ce83bd0c6a36f7edabab1b5a1b04224298b54 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -4932,12 +4932,16 @@ 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::IDENTIFIER) break; |
Dan Ehrenberg
2017/02/17 08:37:14
Another case you can include here is "let {", whic
vabr (Chromium)
2017/02/17 09:52:07
Good idea! Done.
|
impl()->ReportMessageAt(scanner()->peek_location(), |
MessageTemplate::kUnexpectedLexicalDeclaration); |
*ok = false; |
return impl()->NullStatement(); |
+ } |
default: |
break; |
} |