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 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1444 scope = scope->sibling_) { | 1444 scope = scope->sibling_) { |
1445 PrintF("\n"); | 1445 PrintF("\n"); |
1446 scope->Print(n1); | 1446 scope->Print(n1); |
1447 } | 1447 } |
1448 } | 1448 } |
1449 | 1449 |
1450 Indent(n0, "}\n"); | 1450 Indent(n0, "}\n"); |
1451 } | 1451 } |
1452 | 1452 |
1453 void Scope::CheckScopePositions() { | 1453 void Scope::CheckScopePositions() { |
1454 // A scope is allowed to have invalid positions if it is hidden and has no | 1454 // Visible leaf scopes must have real positions. |
1455 // inner scopes | |
jwolfe
2016/10/06 19:17:44
The typo here is a bit subtle. A minimal change to
| |
1456 if (!is_hidden() && inner_scope_ == nullptr) { | 1455 if (!is_hidden() && inner_scope_ == nullptr) { |
1457 CHECK_NE(kNoSourcePosition, start_position()); | 1456 CHECK_NE(kNoSourcePosition, start_position()); |
1458 CHECK_NE(kNoSourcePosition, end_position()); | 1457 CHECK_NE(kNoSourcePosition, end_position()); |
1459 } | 1458 } |
1460 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { | 1459 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { |
1461 scope->CheckScopePositions(); | 1460 scope->CheckScopePositions(); |
1462 } | 1461 } |
1463 } | 1462 } |
1464 | 1463 |
1465 void Scope::CheckZones() { | 1464 void Scope::CheckZones() { |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1912 Variable* function = | 1911 Variable* function = |
1913 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 1912 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
1914 bool is_function_var_in_context = | 1913 bool is_function_var_in_context = |
1915 function != nullptr && function->IsContextSlot(); | 1914 function != nullptr && function->IsContextSlot(); |
1916 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1915 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1917 (is_function_var_in_context ? 1 : 0); | 1916 (is_function_var_in_context ? 1 : 0); |
1918 } | 1917 } |
1919 | 1918 |
1920 } // namespace internal | 1919 } // namespace internal |
1921 } // namespace v8 | 1920 } // namespace v8 |
OLD | NEW |