OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/debug/debug-scopes.h" | 5 #include "src/debug/debug-scopes.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 int position) { | 792 int position) { |
793 if (scope->is_hidden()) { | 793 if (scope->is_hidden()) { |
794 // We need to add this chain element in case the scope has a context | 794 // We need to add this chain element in case the scope has a context |
795 // associated. We need to keep the scope chain and context chain in sync. | 795 // associated. We need to keep the scope chain and context chain in sync. |
796 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate))); | 796 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate))); |
797 } else { | 797 } else { |
798 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate), | 798 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate), |
799 scope->start_position(), | 799 scope->start_position(), |
800 scope->end_position())); | 800 scope->end_position())); |
801 } | 801 } |
802 for (int i = 0; i < scope->inner_scopes()->length(); i++) { | 802 for (Scope* inner_scope = scope->inner_scope(); inner_scope != nullptr; |
803 Scope* inner_scope = scope->inner_scopes()->at(i); | 803 inner_scope = inner_scope->sibling()) { |
804 int beg_pos = inner_scope->start_position(); | 804 int beg_pos = inner_scope->start_position(); |
805 int end_pos = inner_scope->end_position(); | 805 int end_pos = inner_scope->end_position(); |
806 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 806 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
807 if (beg_pos <= position && position < end_pos) { | 807 if (beg_pos <= position && position < end_pos) { |
808 GetNestedScopeChain(isolate, inner_scope, position); | 808 GetNestedScopeChain(isolate, inner_scope, position); |
809 return; | 809 return; |
810 } | 810 } |
811 } | 811 } |
812 } | 812 } |
813 | 813 |
814 } // namespace internal | 814 } // namespace internal |
815 } // namespace v8 | 815 } // namespace v8 |
OLD | NEW |