diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc index f0d49a6ff0..c5ae0b31c4 100644 --- a/src/ast/scopes.cc +++ b/src/ast/scopes.cc @@ -1952,7 +1952,7 @@ void UpdateNeedsHoleCheck(Variable* var, VariableProxy* proxy, Scope* scope) { // the source physically located after the initializer of the variable, // and that the initializer cannot be skipped due to a nonlinear scope. // - // The condition on the declaration scopes is a conservative check for + // The condition on the closure scopes is a conservative check for // nested functions that access a binding and are called before the // binding is initialized: // function() { f(); let x = 1; function f() { x = 2; } } @@ -1962,12 +1962,12 @@ void UpdateNeedsHoleCheck(Variable* var, VariableProxy* proxy, Scope* scope) { // switch (1) { case 0: let x = 2; case 1: f(x); } // The scope of the variable needs to be checked, in case the use is // in a sub-block which may be linear. - if (var->scope()->GetDeclarationScope() != scope->GetDeclarationScope()) { + if (var->scope()->GetClosureScope() != scope->GetClosureScope()) { return SetNeedsHoleCheck(var, proxy); } if (var->is_this()) { - DCHECK(IsDerivedConstructor(scope->GetDeclarationScope()->function_kind())); + DCHECK(IsDerivedConstructor(scope->GetClosureScope()->function_kind())); // TODO(littledan): implement 'this' hole check elimination. return SetNeedsHoleCheck(var, proxy); }