Chromium Code Reviews| Index: src/ast/scopes.cc |
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
| index c150336668545eb1a8bf78b3af3823f70bb476c1..06a11f3eef1bb79fa538db2399da204effcdc8e4 100644 |
| --- a/src/ast/scopes.cc |
| +++ b/src/ast/scopes.cc |
| @@ -1613,26 +1613,15 @@ void Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy) { |
| Variable* var = LookupRecursive(proxy, nullptr); |
| ResolveTo(info, proxy, var); |
| - if (FLAG_lazy_inner_functions) { |
| - if (info != nullptr && info->is_native()) return; |
| - // Pessimistically force context allocation for all variables to which inner |
| - // scope variables could potentially resolve to. |
| - Scope* scope = GetClosureScope()->outer_scope_; |
| - while (scope != nullptr && scope->scope_info_.is_null()) { |
| - var = scope->LookupLocal(proxy->raw_name()); |
| - if (var != nullptr) { |
| - // Since we don't lazy parse inner arrow functions, inner functions |
| - // cannot refer to the outer "this". |
| - if (!var->is_dynamic() && !var->is_this() && |
| - !var->has_forced_context_allocation()) { |
| - var->ForceContextAllocation(); |
| - var->set_is_used(); |
| - // We don't know what the (potentially lazy parsed) inner function |
| - // does with the variable; pessimistically assume that it's assigned. |
| - var->set_maybe_assigned(); |
| - } |
| - } |
| - scope = scope->outer_scope_; |
| + // Pessimistically set is_used and maybe_assigned for variables which lazy |
| + // parsed inner functions refer to. |
| + if (FLAG_lazy_inner_functions && is_declaration_scope() && |
| + AsDeclarationScope()->is_lazily_parsed()) { |
| + // Since we don't lazy parse inner arrow functions, inner functions |
| + // cannot refer to the outer "this". |
| + if (!var->is_dynamic() && !var->is_this()) { |
| + var->set_is_used(); |
| + var->set_maybe_assigned(); |
|
Toon Verwaest
2016/11/22 13:11:42
I don't think we need to set is_used here, since R
|
| } |
| } |
| } |