Chromium Code Reviews| Index: src/parsing/parser.cc |
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
| index 4c553d8ae48f35510ce803399c65669449da6012..9c5af44b43218e7e0841aa8fd826d39762417f91 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(); |
|
marja
2017/02/10 08:16:59
Should the is_used be moved to DeclareGeneratorObj
caitp
2017/02/10 10:04:59
Fair enough, done
|
| } |
| FunctionLiteral* Parser::ParseFunctionLiteral( |
| @@ -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(); |
|
marja
2017/02/10 08:16:59
Ditto
caitp
2017/02/10 10:04:59
Both moved
|
| } |
| return promise; |
| } |