| Index: src/parsing/parser.h
|
| diff --git a/src/parsing/parser.h b/src/parsing/parser.h
|
| index 33ea4c61c717d82703fd14c6925de166ca913590..e95342dd4511fd73e706e2c11223d49b1702549c 100644
|
| --- a/src/parsing/parser.h
|
| +++ b/src/parsing/parser.h
|
| @@ -529,7 +529,11 @@ class ParserTraits {
|
|
|
| V8_INLINE void AddParameterInitializationBlock(
|
| const ParserFormalParameters& parameters,
|
| - ZoneList<v8::internal::Statement*>* body, bool* ok);
|
| + ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok);
|
| +
|
| + void ParseAsyncArrowSingleExpressionBody(
|
| + ZoneList<Statement*>* body, bool accept_IN,
|
| + Type::ExpressionClassifier* classifier, int pos, bool* ok);
|
|
|
| V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type,
|
| FunctionKind kind = kNormalFunction);
|
| @@ -962,6 +966,12 @@ class Parser : public ParserBase<ParserTraits> {
|
| ZoneList<const AstRawString*>* names, ForStatement* loop, Statement* init,
|
| Expression* cond, Statement* next, Statement* body, bool* ok);
|
|
|
| + void DesugarAsyncFunctionBody(const AstRawString* function_name, Scope* scope,
|
| + ZoneList<Statement*>* body,
|
| + Type::ExpressionClassifier* classifier,
|
| + FunctionKind kind, FunctionBody type,
|
| + bool accept_IN, int pos, bool* ok);
|
| +
|
| void RewriteDoExpression(Expression* expr, bool* ok);
|
|
|
| FunctionLiteral* ParseFunctionLiteral(
|
| @@ -1032,6 +1042,7 @@ class Parser : public ParserBase<ParserTraits> {
|
|
|
| Block* BuildParameterInitializationBlock(
|
| const ParserFormalParameters& parameters, bool* ok);
|
| + Block* BuildRejectPromiseOnException(Block* block);
|
|
|
| // Consumes the ending }.
|
| ZoneList<Statement*>* ParseEagerFunctionBody(
|
| @@ -1074,6 +1085,10 @@ class Parser : public ParserBase<ParserTraits> {
|
| friend class InitializerRewriter;
|
| void RewriteParameterInitializer(Expression* expr, Scope* scope);
|
|
|
| + Expression* EmitCreateJSGeneratorObject(int pos);
|
| + Expression* EmitPromiseResolve(Expression* value, int pos);
|
| + Expression* EmitPromiseReject(Expression* value, int pos);
|
| +
|
| Scanner scanner_;
|
| PreParser* reusable_preparser_;
|
| Scope* original_scope_; // for ES5 function declarations in sloppy eval
|
| @@ -1243,14 +1258,18 @@ void ParserTraits::DeclareFormalParameter(
|
| }
|
| }
|
|
|
| -
|
| void ParserTraits::AddParameterInitializationBlock(
|
| const ParserFormalParameters& parameters,
|
| - ZoneList<v8::internal::Statement*>* body, bool* ok) {
|
| + ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) {
|
| if (!parameters.is_simple) {
|
| auto* init_block =
|
| parser_->BuildParameterInitializationBlock(parameters, ok);
|
| if (!*ok) return;
|
| +
|
| + if (is_async) {
|
| + init_block = parser_->BuildRejectPromiseOnException(init_block);
|
| + }
|
| +
|
| if (init_block != nullptr) {
|
| body->Add(init_block, parser_->zone());
|
| }
|
|
|