| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index 805b6ef066bfe5ea0cd4669cf2ad2a387b022873..f50a2eac4fbdb766a141d88c1f6b6f826a3b03d5 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -1615,8 +1615,6 @@ Expression* Parser::RewriteReturn(Expression* return_value, int pos) {
|
| }
|
| if (is_generator()) {
|
| return_value = BuildIteratorResult(return_value, true);
|
| - } else if (is_async_function()) {
|
| - return_value = BuildResolvePromise(return_value, return_value->position());
|
| }
|
| return return_value;
|
| }
|
| @@ -2479,9 +2477,9 @@ void Parser::PrepareGeneratorVariables() {
|
| // Calling a generator returns a generator object. That object is stored
|
| // in a temporary variable, a definition that is used by "yield"
|
| // expressions.
|
| - Variable* temp =
|
| - NewTemporary(ast_value_factory()->dot_generator_object_string());
|
| - function_state_->set_generator_object_variable(temp);
|
| + Variable* temp = function_state_->scope()->DeclareGeneratorObjectVar(
|
| + ast_value_factory()->dot_generator_object_string());
|
| + temp->set_is_used();
|
| }
|
|
|
| FunctionLiteral* Parser::ParseFunctionLiteral(
|
| @@ -3013,7 +3011,7 @@ Block* Parser::BuildRejectPromiseOnException(Block* inner_block) {
|
| Expression* promise_reject = BuildRejectPromise(
|
| factory()->NewVariableProxy(catch_variable), kNoSourcePosition);
|
| ReturnStatement* return_promise_reject =
|
| - factory()->NewReturnStatement(promise_reject, kNoSourcePosition);
|
| + factory()->NewHardReturnStatement(promise_reject, kNoSourcePosition);
|
| catch_block->statements()->Add(return_promise_reject, zone());
|
|
|
| TryStatement* try_catch_statement =
|
| @@ -3095,8 +3093,9 @@ Variable* Parser::PromiseVariable() {
|
| // comes first should create it and stash it in the FunctionState.
|
| Variable* promise = function_state_->promise_variable();
|
| if (function_state_->promise_variable() == nullptr) {
|
| - promise = scope()->NewTemporary(ast_value_factory()->empty_string());
|
| - function_state_->set_promise_variable(promise);
|
| + promise = function_state_->scope()->DeclarePromiseVar(
|
| + ast_value_factory()->empty_string());
|
| + promise->set_is_used();
|
| }
|
| return promise;
|
| }
|
| @@ -3788,7 +3787,7 @@ void Parser::RewriteAsyncFunctionBody(ZoneList<Statement*>* body, Block* block,
|
|
|
| return_value = BuildResolvePromise(return_value, return_value->position());
|
| block->statements()->Add(
|
| - factory()->NewReturnStatement(return_value, return_value->position()),
|
| + factory()->NewHardReturnStatement(return_value, return_value->position()),
|
| zone());
|
| block = BuildRejectPromiseOnException(block);
|
| body->Add(block, zone());
|
|
|