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

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

Issue 2672313003: [async await] fix async await desugaring
Patch Set: fmt 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
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index e1e3d3412281a274f2a3d03079735cc7c113a2de..3553b9fb1d17d44c28122773d43908030aeb2445 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -438,7 +438,7 @@ class ParserBase {
}
void set_promise_variable(typename Types::Variable* variable) {
- DCHECK(variable != NULL);
+ DCHECK_NOT_NULL(variable);
DCHECK(IsAsyncFunction(kind()));
promise_variable_ = variable;
}
@@ -446,6 +446,15 @@ class ParserBase {
return promise_variable_;
}
+ void set_async_return_variable(typename Types::Variable* variable) {
+ DCHECK_NOT_NULL(variable);
+ 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);
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698