Index: src/parsing/preparser.h |
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h |
index c803928fd8e30582acf74c3657e3f40f05660241..c61eb608293f4521ee82d411f5c7692ae804d50b 100644 |
--- a/src/parsing/preparser.h |
+++ b/src/parsing/preparser.h |
@@ -55,6 +55,12 @@ class PreParserIdentifier { |
static PreParserIdentifier Constructor() { |
return PreParserIdentifier(kConstructorIdentifier); |
} |
+ static PreParserIdentifier Async() { |
+ return PreParserIdentifier(kAsyncIdentifier); |
+ } |
+ static PreParserIdentifier Await() { |
+ return PreParserIdentifier(kAwaitIdentifier); |
+ } |
bool IsEval() const { return type_ == kEvalIdentifier; } |
bool IsArguments() const { return type_ == kArgumentsIdentifier; } |
bool IsEvalOrArguments() const { return IsEval() || IsArguments(); } |
@@ -64,7 +70,12 @@ class PreParserIdentifier { |
bool IsYield() const { return type_ == kYieldIdentifier; } |
bool IsPrototype() const { return type_ == kPrototypeIdentifier; } |
bool IsConstructor() const { return type_ == kConstructorIdentifier; } |
- bool IsFutureReserved() const { return type_ == kFutureReservedIdentifier; } |
+ 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 || |
type_ == kLetIdentifier || type_ == kStaticIdentifier || |
@@ -91,7 +102,9 @@ class PreParserIdentifier { |
kArgumentsIdentifier, |
kUndefinedIdentifier, |
kPrototypeIdentifier, |
- kConstructorIdentifier |
+ kConstructorIdentifier, |
+ kAsyncIdentifier, |
+ kAwaitIdentifier |
}; |
explicit PreParserIdentifier(Type type) : type_(type) {} |
@@ -597,6 +610,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(); |
} |
@@ -832,6 +853,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 {}; |
@@ -900,6 +923,11 @@ class PreParserTraits { |
PreParserExpressionList args, |
int pos); |
+ inline PreParserExpression ExpressionListToExpression( |
+ PreParserExpressionList args) { |
+ return PreParserExpression::Default(); |
+ } |
+ |
inline void RewriteDestructuringAssignments() {} |
inline PreParserExpression RewriteExponentiation(PreParserExpression left, |
@@ -923,6 +951,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; |
@@ -1025,6 +1056,8 @@ class PreParser : public ParserBase<PreParserTraits> { |
bool* ok); |
Statement ParseScopedStatement(bool legacy, 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, |
@@ -1110,6 +1143,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); |
@@ -1121,6 +1157,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(); |