Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 61cb883f8a664f8695ce78de9477b6bae6995f89..f3bd4a294fadf91e04ba76243977c1fbca36a2e4 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -336,6 +336,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; |
{ |
@@ -709,6 +714,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 IsLetKeyword(); |
+ |
// 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. |
@@ -3734,6 +3741,27 @@ void ParserBase<Traits>::CheckArityRestrictions( |
template <class Traits> |
+bool ParserBase<Traits>::IsLetKeyword() { |
adamk
2015/08/15 00:28:31
How about "IsNextLetKeyword()"? I think that makes
Dan Ehrenberg
2015/08/17 18:05:02
Done
|
+ DCHECK(peek() == Token::LET); |
+ if (!allow_let()) { |
+ return false; |
+ } |
+ Token::Value uber_next = PeekAhead(); |
adamk
2015/08/15 00:28:31
next_next, maybe? See later comment.
Dan Ehrenberg
2015/08/17 18:05:01
Done
|
+ switch (uber_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, |