| OLD | NEW | 
|     1 // Copyright 2012 the V8 project authors. All rights reserved. |     1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 #include "src/ast/scopes.h" |     5 #include "src/ast/scopes.h" | 
|     6  |     6  | 
|     7 #include <set> |     7 #include <set> | 
|     8  |     8  | 
|     9 #include "src/accessors.h" |     9 #include "src/accessors.h" | 
|    10 #include "src/ast/ast.h" |    10 #include "src/ast/ast.h" | 
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1439  |  1439  | 
|  1440   // The variable could not be resolved statically. |  1440   // The variable could not be resolved statically. | 
|  1441   if (var == nullptr) return var; |  1441   if (var == nullptr) return var; | 
|  1442  |  1442  | 
|  1443   if (is_function_scope() && !var->is_dynamic()) { |  1443   if (is_function_scope() && !var->is_dynamic()) { | 
|  1444     var->ForceContextAllocation(); |  1444     var->ForceContextAllocation(); | 
|  1445   } |  1445   } | 
|  1446   // "this" can't be shadowed by "eval"-introduced bindings or by "with" |  1446   // "this" can't be shadowed by "eval"-introduced bindings or by "with" | 
|  1447   // scopes. |  1447   // scopes. | 
|  1448   // TODO(wingo): There are other variables in this category; add them. |  1448   // TODO(wingo): There are other variables in this category; add them. | 
|  1449   if (var->is_this()) return var; |  1449   if (ScopeInfo::VariableIsSynthetic(*var->name())) return var; | 
|  1450  |  1450  | 
|  1451   if (is_with_scope()) { |  1451   if (is_with_scope()) { | 
|  1452     // The current scope is a with scope, so the variable binding can not be |  1452     // The current scope is a with scope, so the variable binding can not be | 
|  1453     // statically resolved. However, note that it was necessary to do a lookup |  1453     // statically resolved. However, note that it was necessary to do a lookup | 
|  1454     // in the outer scope anyway, because if a binding exists in an outer |  1454     // in the outer scope anyway, because if a binding exists in an outer | 
|  1455     // scope, the associated variable has to be marked as potentially being |  1455     // scope, the associated variable has to be marked as potentially being | 
|  1456     // accessed from inside of an inner with scope (the property may not be in |  1456     // accessed from inside of an inner with scope (the property may not be in | 
|  1457     // the 'with' object). |  1457     // the 'with' object). | 
|  1458     if (!var->is_dynamic() && var->IsUnallocated()) { |  1458     if (!var->is_dynamic() && var->IsUnallocated()) { | 
|  1459       DCHECK(!already_resolved_); |  1459       DCHECK(!already_resolved_); | 
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1811   Variable* function = |  1811   Variable* function = | 
|  1812       is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |  1812       is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 
|  1813   bool is_function_var_in_context = |  1813   bool is_function_var_in_context = | 
|  1814       function != nullptr && function->IsContextSlot(); |  1814       function != nullptr && function->IsContextSlot(); | 
|  1815   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |  1815   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 
|  1816          (is_function_var_in_context ? 1 : 0); |  1816          (is_function_var_in_context ? 1 : 0); | 
|  1817 } |  1817 } | 
|  1818  |  1818  | 
|  1819 }  // namespace internal |  1819 }  // namespace internal | 
|  1820 }  // namespace v8 |  1820 }  // namespace v8 | 
| OLD | NEW |