Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: src/parsing/parser.cc

Issue 2685683002: [async-await] (simpler) fix for Return in try/finally in async functions (Closed)
Patch Set: remove comment Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}
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();
}
return promise;
}

Powered by Google App Engine
This is Rietveld 408576698