Chromium Code Reviews| Index: src/parsing/parser.h |
| diff --git a/src/parsing/parser.h b/src/parsing/parser.h |
| index 6ab00c654ab6d63674d51e3c756d44842c5ed6c4..3f4092939d0ad95bdfee02ba9b47c80a2d6fdcee 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); |
| @@ -965,6 +969,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( |
| @@ -1035,6 +1045,7 @@ class Parser : public ParserBase<ParserTraits> { |
| Block* BuildParameterInitializationBlock( |
| const ParserFormalParameters& parameters, bool* ok); |
| + Block* BuildRejectPromiseOnException(Block* block); |
| // Consumes the ending }. |
| ZoneList<Statement*>* ParseEagerFunctionBody( |
| @@ -1079,6 +1090,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 |
| @@ -1248,14 +1263,18 @@ void ParserTraits::DeclareFormalParameter( |
| } |
| } |
| - |
|
Dan Ehrenberg
2016/05/04 22:52:36
Nit: no need to delete the line
|
| 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()); |
| } |