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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 } | 1342 } |
1343 | 1343 |
1344 Scope* Scope::GetOuterScopeWithContext() { | 1344 Scope* Scope::GetOuterScopeWithContext() { |
1345 Scope* scope = outer_scope_; | 1345 Scope* scope = outer_scope_; |
1346 while (scope && !scope->NeedsContext()) { | 1346 while (scope && !scope->NeedsContext()) { |
1347 scope = scope->outer_scope(); | 1347 scope = scope->outer_scope(); |
1348 } | 1348 } |
1349 return scope; | 1349 return scope; |
1350 } | 1350 } |
1351 | 1351 |
| 1352 bool Scope::HasLazilyParsedInnerFunctionScope() const { |
| 1353 for (Scope* scope = inner_scope_; scope; scope = scope->sibling_) { |
| 1354 if (scope->is_function_scope()) { |
| 1355 if (static_cast<DeclarationScope*>(scope)->was_lazily_parsed()) { |
| 1356 return true; |
| 1357 } |
| 1358 } |
| 1359 if (scope->HasLazilyParsedInnerFunctionScope()) return true; |
| 1360 } |
| 1361 return false; |
| 1362 } |
| 1363 |
1352 Handle<StringSet> DeclarationScope::CollectNonLocals( | 1364 Handle<StringSet> DeclarationScope::CollectNonLocals( |
1353 ParseInfo* info, Handle<StringSet> non_locals) { | 1365 ParseInfo* info, Handle<StringSet> non_locals) { |
1354 VariableProxy* free_variables = FetchFreeVariables(this, info); | 1366 VariableProxy* free_variables = FetchFreeVariables(this, info); |
1355 for (VariableProxy* proxy = free_variables; proxy != nullptr; | 1367 for (VariableProxy* proxy = free_variables; proxy != nullptr; |
1356 proxy = proxy->next_unresolved()) { | 1368 proxy = proxy->next_unresolved()) { |
1357 non_locals = StringSet::Add(non_locals, proxy->name()); | 1369 non_locals = StringSet::Add(non_locals, proxy->name()); |
1358 } | 1370 } |
1359 return non_locals; | 1371 return non_locals; |
1360 } | 1372 } |
1361 | 1373 |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2207 Variable* function = | 2219 Variable* function = |
2208 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 2220 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
2209 bool is_function_var_in_context = | 2221 bool is_function_var_in_context = |
2210 function != nullptr && function->IsContextSlot(); | 2222 function != nullptr && function->IsContextSlot(); |
2211 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 2223 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
2212 (is_function_var_in_context ? 1 : 0); | 2224 (is_function_var_in_context ? 1 : 0); |
2213 } | 2225 } |
2214 | 2226 |
2215 } // namespace internal | 2227 } // namespace internal |
2216 } // namespace v8 | 2228 } // namespace v8 |
OLD | NEW |