Index: src/parsing/preparser.h |
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h |
index 9e57442daf750fed05f09dc2e70c0993b84ebb4e..dda14af1ec027771ba09776fa300e5744c0ebf3e 100644 |
--- a/src/parsing/preparser.h |
+++ b/src/parsing/preparser.h |
@@ -58,6 +58,9 @@ class PreParserIdentifier { |
static PreParserIdentifier Enum() { |
return PreParserIdentifier(kEnumIdentifier); |
} |
+ static PreParserIdentifier Async() { |
+ return PreParserIdentifier(kAsyncIdentifier); |
+ } |
static PreParserIdentifier Await() { |
return PreParserIdentifier(kAwaitIdentifier); |
} |
@@ -71,6 +74,11 @@ class PreParserIdentifier { |
bool IsPrototype() const { return type_ == kPrototypeIdentifier; } |
bool IsConstructor() const { return type_ == kConstructorIdentifier; } |
bool IsEnum() const { return type_ == kEnumIdentifier; } |
+ bool IsFutureReserved() const { |
+ // TODO(caitp): include `kAwaitIdentifier` when parsing a Module |
+ return type_ == kFutureReservedIdentifier; |
+ } |
+ bool IsAsync() const { return type_ == kAsyncIdentifier; } |
bool IsAwait() const { return type_ == kAwaitIdentifier; } |
bool IsFutureStrictReserved() const { |
return type_ == kFutureStrictReservedIdentifier || |
@@ -100,6 +108,7 @@ class PreParserIdentifier { |
kPrototypeIdentifier, |
kConstructorIdentifier, |
kEnumIdentifier, |
+ kAsyncIdentifier, |
kAwaitIdentifier |
}; |
@@ -606,6 +615,14 @@ class PreParserTraits { |
return identifier.IsArguments(); |
} |
+ static bool IsAsync(PreParserIdentifier identifier) { |
+ return identifier.IsAsync(); |
+ } |
+ |
+ static bool IsAwait(PreParserIdentifier identifier) { |
+ return identifier.IsAwait(); |
+ } |
+ |
static bool IsEvalOrArguments(PreParserIdentifier identifier) { |
return identifier.IsEvalOrArguments(); |
} |
@@ -841,6 +858,8 @@ class PreParserTraits { |
PreParserExpression expression, const Scanner::Location& params_loc, |
Scanner::Location* duplicate_loc, bool* ok); |
+ V8_INLINE PreParserExpression ParseAsyncFunctionExpression(bool* ok); |
+ |
void ReindexLiterals(const PreParserFormalParameters& paramaters) {} |
struct TemplateLiteralState {}; |
@@ -913,6 +932,11 @@ class PreParserTraits { |
PreParserExpressionList args, |
int pos); |
+ inline PreParserExpression ExpressionListToExpression( |
+ PreParserExpressionList args) { |
+ return PreParserExpression::Default(); |
Dan Ehrenberg
2016/05/05 01:14:40
When do you accumulate these to a classifier/valid
caitp (gmail)
2016/05/05 01:36:57
The main use of this is to be able to translate `a
|
+ } |
+ |
inline void RewriteDestructuringAssignments() {} |
inline PreParserExpression RewriteExponentiation(PreParserExpression left, |
@@ -936,6 +960,9 @@ class PreParserTraits { |
inline void RewriteNonPattern(Type::ExpressionClassifier* classifier, |
bool* ok); |
+ inline PreParserExpression RewriteAwaitExpression(PreParserExpression value, |
+ int pos); |
+ |
V8_INLINE Zone* zone() const; |
V8_INLINE ZoneList<PreParserExpression>* GetNonPatternList() const; |
@@ -1054,6 +1081,8 @@ class PreParser : public ParserBase<PreParserTraits> { |
Statement ParseHoistableDeclaration(bool* ok); |
Statement ParseHoistableDeclaration(int pos, bool is_generator, bool* ok); |
Statement ParseFunctionDeclaration(bool* ok); |
+ Statement ParseAsyncFunctionDeclaration(bool* ok); |
+ Expression ParseAsyncFunctionExpression(bool* ok); |
Statement ParseClassDeclaration(bool* ok); |
Statement ParseBlock(bool* ok); |
Statement ParseVariableStatement(VariableDeclarationContext var_context, |
@@ -1142,6 +1171,9 @@ void PreParserTraits::ParseArrowFunctionFormalParameterList( |
// lists that are too long. |
} |
+PreParserExpression PreParserTraits::ParseAsyncFunctionExpression(bool* ok) { |
+ return pre_parser_->ParseAsyncFunctionExpression(ok); |
+} |
PreParserExpression PreParserTraits::ParseDoExpression(bool* ok) { |
return pre_parser_->ParseDoExpression(ok); |
@@ -1153,6 +1185,10 @@ void PreParserTraits::RewriteNonPattern(Type::ExpressionClassifier* classifier, |
pre_parser_->ValidateExpression(classifier, ok); |
} |
+PreParserExpression PreParserTraits::RewriteAwaitExpression( |
+ PreParserExpression value, int pos) { |
+ return value; |
+} |
Zone* PreParserTraits::zone() const { |
return pre_parser_->function_state_->scope()->zone(); |