| 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);
|
|
|