Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 07e431bfc54790b0a65c081f9ea8021ab6fba84c..f60ada27fe2da79a94196ae9f3b2fbf4ce303ed2 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. |
@@ -3776,6 +3783,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, |