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 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1876 for (Scope* scope = inner_scope_; scope != nullptr; | 1876 for (Scope* scope = inner_scope_; scope != nullptr; |
1877 scope = scope->sibling_) { | 1877 scope = scope->sibling_) { |
1878 scope->ResolveVariablesRecursively(info); | 1878 scope->ResolveVariablesRecursively(info); |
1879 } | 1879 } |
1880 } | 1880 } |
1881 } | 1881 } |
1882 | 1882 |
1883 VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope, | 1883 VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope, |
1884 ParseInfo* info, | 1884 ParseInfo* info, |
1885 VariableProxy* stack) { | 1885 VariableProxy* stack) { |
1886 // Module variables must be allocated before variable resolution | |
1887 // to ensure that AccessNeedsHoleCheck() can detect import variables. | |
1888 if (is_module_scope()) AsModuleScope()->AllocateModuleVariables(); | |
kozy
2017/01/30 23:25:11
Adam, could you please take a look on these lines?
adamk
2017/01/30 23:34:35
Can you guard this with "info != nullptr" as well?
kozy
2017/01/30 23:40:40
Done.
| |
1886 // Lazy parsed declaration scopes are already partially analyzed. If there are | 1889 // Lazy parsed declaration scopes are already partially analyzed. If there are |
1887 // unresolved references remaining, they just need to be resolved in outer | 1890 // unresolved references remaining, they just need to be resolved in outer |
1888 // scopes. | 1891 // scopes. |
1889 Scope* lookup = | 1892 Scope* lookup = |
1890 is_declaration_scope() && AsDeclarationScope()->was_lazily_parsed() | 1893 is_declaration_scope() && AsDeclarationScope()->was_lazily_parsed() |
1891 ? outer_scope() | 1894 ? outer_scope() |
1892 : this; | 1895 : this; |
1893 for (VariableProxy *proxy = unresolved_, *next = nullptr; proxy != nullptr; | 1896 for (VariableProxy *proxy = unresolved_, *next = nullptr; proxy != nullptr; |
1894 proxy = next) { | 1897 proxy = next) { |
1895 next = proxy->next_unresolved(); | 1898 next = proxy->next_unresolved(); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2207 Variable* function = | 2210 Variable* function = |
2208 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 2211 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
2209 bool is_function_var_in_context = | 2212 bool is_function_var_in_context = |
2210 function != nullptr && function->IsContextSlot(); | 2213 function != nullptr && function->IsContextSlot(); |
2211 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 2214 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
2212 (is_function_var_in_context ? 1 : 0); | 2215 (is_function_var_in_context ? 1 : 0); |
2213 } | 2216 } |
2214 | 2217 |
2215 } // namespace internal | 2218 } // namespace internal |
2216 } // namespace v8 | 2219 } // namespace v8 |
OLD | NEW |