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

Unified Diff: src/parsing/parser-base.h

Issue 2672313003: [async await] fix async await desugaring
Patch Set: refactor 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-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index e1e3d3412281a274f2a3d03079735cc7c113a2de..3f235a748392d1c78256760a178478f04240e6b0 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -446,6 +446,15 @@ class ParserBase {
return promise_variable_;
}
+ void set_async_return_variable(typename Types::Variable* variable) {
+ DCHECK(variable != NULL);
neis 2017/02/08 10:28:41 DCHECK_NOT_NULL
gsathya 2017/02/09 00:55:44 Done.
+ DCHECK(IsAsyncFunction(kind()));
+ async_return_variable_ = variable;
+ }
+ typename Types::Variable* async_return_variable() const {
+ return async_return_variable_;
+ }
+
const ZoneList<DestructuringAssignment>&
destructuring_assignments_to_rewrite() const {
return destructuring_assignments_to_rewrite_;
@@ -515,6 +524,8 @@ class ParserBase {
// For async functions, this variable holds a temporary for the Promise
// being created as output of the async function.
Variable* promise_variable_;
+ Variable* async_return_variable_;
+ Variable* is_rejection_variable_;
FunctionState** function_state_stack_;
FunctionState* outer_function_state_;
@@ -1518,6 +1529,8 @@ ParserBase<Impl>::FunctionState::FunctionState(
expected_property_count_(0),
generator_object_variable_(nullptr),
promise_variable_(nullptr),
+ async_return_variable_(nullptr),
+ is_rejection_variable_(nullptr),
function_state_stack_(function_state_stack),
outer_function_state_(*function_state_stack),
destructuring_assignments_to_rewrite_(16, scope->zone()),
@@ -4054,7 +4067,8 @@ void ParserBase<Impl>::ParseFunctionBody(
// TODO(littledan): Merge the two rejection blocks into one
if (IsAsyncFunction(kind)) {
- init_block = impl()->BuildRejectPromiseOnException(init_block);
+ init_block =
+ impl()->BuildRejectPromiseOnExceptionForParameters(init_block);
}
inner_scope->set_end_position(scanner()->location().end_pos);

Powered by Google App Engine
This is Rietveld 408576698