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

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

Issue 2359513002: Remove synthetic unresolved variables from async/await desugaring (Closed)
Patch Set: Fix bug number Created 4 years, 3 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 518ef91db8cab89a8de7bf20db8b959664d397d7..2b07045aebbfdf5b6cb12c4fb5d8a951012a4fca 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -125,7 +125,7 @@ struct FormalParametersBase {
// typedef Impl;
// // TODO(nikolaos): this one will probably go away, as it is
// // not related to pure parsing.
-// typedef GeneratorVariable;
+// typedef Variable;
// // Return types for traversing functions.
// typedef Identifier;
// typedef Expression;
@@ -405,16 +405,24 @@ class ParserBase {
FunctionKind kind() const { return kind_; }
FunctionState* outer() const { return outer_function_state_; }
- void set_generator_object_variable(
- typename Types::GeneratorVariable* variable) {
+ void set_generator_object_variable(typename Types::Variable* variable) {
DCHECK(variable != NULL);
DCHECK(is_resumable());
generator_object_variable_ = variable;
}
- typename Types::GeneratorVariable* generator_object_variable() const {
+ typename Types::Variable* generator_object_variable() const {
return generator_object_variable_;
}
+ void set_promise_variable(typename Types::Variable* variable) {
+ DCHECK(variable != NULL);
+ DCHECK(is_async_function());
+ promise_variable_ = variable;
+ }
+ typename Types::Variable* promise_variable() const {
+ return promise_variable_;
+ }
+
const ZoneList<DestructuringAssignment>&
destructuring_assignments_to_rewrite() const {
return destructuring_assignments_to_rewrite_;
@@ -490,6 +498,9 @@ class ParserBase {
// is used by yield expressions and return statements. It is not necessary
// for generator functions to have this variable set.
Variable* generator_object_variable_;
+ // For async functions, this variable holds a temporary for the Promise
+ // being created as output of the async function.
+ Variable* promise_variable_;
FunctionState** function_state_stack_;
FunctionState* outer_function_state_;
@@ -1429,7 +1440,8 @@ ParserBase<Impl>::FunctionState::FunctionState(
next_materialized_literal_index_(0),
expected_property_count_(0),
kind_(kind),
- generator_object_variable_(NULL),
+ generator_object_variable_(nullptr),
+ promise_variable_(nullptr),
function_state_stack_(function_state_stack),
outer_function_state_(*function_state_stack),
destructuring_assignments_to_rewrite_(16, scope->zone()),
« 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