Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 18fc2330eedd7f646683035bba73e311d6f8d12a..41e8dde6ffcfe1dd986348bf799076b6a775e314 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -338,6 +338,11 @@ class ParserBase : public Traits { |
return scanner()->peek(); |
} |
+ INLINE(Token::Value PeekAhead()) { |
+ if (stack_overflow_) return Token::ILLEGAL; |
+ return scanner()->PeekAhead(); |
+ } |
+ |
INLINE(Token::Value Next()) { |
if (stack_overflow_) return Token::ILLEGAL; |
{ |
@@ -710,6 +715,8 @@ class ParserBase : public Traits { |
int param_count, FunctionLiteral::ArityRestriction arity_restriction, |
bool has_rest, int formals_start_pos, int formals_end_pos, bool* ok); |
+ bool IsNextLetKeyword(); |
+ |
// Checks if the expression is a valid reference expression (e.g., on the |
// left-hand side of assignments). Although ruled out by ECMA as early errors, |
// we allow calls for web compatibility and rewrite them to a runtime throw. |
@@ -3746,6 +3753,27 @@ void ParserBase<Traits>::CheckArityRestrictions( |
template <class Traits> |
+bool ParserBase<Traits>::IsNextLetKeyword() { |
+ DCHECK(peek() == Token::LET); |
+ if (!allow_let()) { |
+ return false; |
+ } |
+ Token::Value next_next = PeekAhead(); |
+ switch (next_next) { |
+ case Token::LBRACE: |
+ case Token::LBRACK: |
+ case Token::IDENTIFIER: |
+ case Token::STATIC: |
+ case Token::LET: // Yes, you can do let let = ... in sloppy mode |
+ case Token::YIELD: |
+ return true; |
+ default: |
+ return false; |
+ } |
+} |
+ |
+ |
+template <class Traits> |
typename ParserBase<Traits>::ExpressionT |
ParserBase<Traits>::ParseArrowFunctionLiteral( |
const FormalParametersT& formal_parameters, |