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

Unified Diff: src/ast/scopes.cc

Issue 2664083002: [ignition] desugar async functions/generators/modules in BytecodeGenerator
Patch Set: get rid of lambdas, for better or worse.. 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/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index bd91e16a5220cccfab9ccb59f7eee7464dedac52..4f720b94eadc18a35c587cb9663b8edaff1451ec 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -298,6 +298,8 @@ void DeclarationScope::SetDefaults() {
function_ = nullptr;
arguments_ = nullptr;
this_function_ = nullptr;
+ generator_object_ = nullptr;
+ promise_ = nullptr;
should_eager_compile_ = false;
was_lazily_parsed_ = false;
#ifdef DEBUG
@@ -703,6 +705,21 @@ Variable* DeclarationScope::DeclareFunctionVar(const AstRawString* name) {
return function_;
}
+Variable* DeclarationScope::DeclareGeneratorObjectVar(
+ const AstRawString* name) {
+ DCHECK(is_function_scope() || is_module_scope());
+ DCHECK_NULL(generator_object_);
+ generator_object_ = NewTemporary(name);
+ return generator_object_;
+}
+
+Variable* DeclarationScope::DeclarePromiseVar(const AstRawString* name) {
+ DCHECK(is_function_scope());
+ DCHECK_NULL(promise_);
+ promise_ = NewTemporary(name);
+ return promise_;
+}
+
bool Scope::HasBeenRemoved() const {
if (sibling() == this) {
DCHECK_NULL(inner_scope_);
@@ -1357,6 +1374,19 @@ Scope* Scope::GetOuterScopeWithContext() {
return scope;
}
+bool Scope::HasLazilyParsedInnerFunctionScope() const {
+ for (Scope* scope = inner_scope_; scope; scope = scope->sibling_) {
+ if (scope->is_function_scope()) {
+ DCHECK(scope->is_declaration_scope_);
+ if (static_cast<DeclarationScope*>(scope)->was_lazily_parsed()) {
+ return true;
+ }
+ if (scope->HasLazilyParsedInnerFunctionScope()) return true;
+ }
+ }
+ return false;
+}
+
Handle<StringSet> DeclarationScope::CollectNonLocals(
ParseInfo* info, Handle<StringSet> non_locals) {
VariableProxy* free_variables = FetchFreeVariables(this, info);
« no previous file with comments | « src/ast/scopes.h ('k') | src/bailout-reason.h » ('j') | src/interpreter/bytecode-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698