| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| 10 #include "src/debug/debug.h" | 11 #include "src/debug/debug.h" |
| 11 #include "src/frames-inl.h" | 12 #include "src/frames-inl.h" |
| 12 #include "src/globals.h" | 13 #include "src/globals.h" |
| 13 #include "src/isolate-inl.h" | 14 #include "src/isolate-inl.h" |
| 14 #include "src/parsing/parse-info.h" | 15 #include "src/parsing/parse-info.h" |
| 15 #include "src/parsing/parser.h" | 16 #include "src/parsing/parsing.h" |
| 16 #include "src/parsing/rewriter.h" | 17 #include "src/parsing/rewriter.h" |
| 17 | 18 |
| 18 namespace v8 { | 19 namespace v8 { |
| 19 namespace internal { | 20 namespace internal { |
| 20 | 21 |
| 21 ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector, | 22 ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector, |
| 22 ScopeIterator::Option option) | 23 ScopeIterator::Option option) |
| 23 : isolate_(isolate), | 24 : isolate_(isolate), |
| 24 frame_inspector_(frame_inspector), | 25 frame_inspector_(frame_inspector), |
| 25 nested_scope_chain_(4), | 26 nested_scope_chain_(4), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 info->set_language_mode(shared_info->language_mode()); | 103 info->set_language_mode(shared_info->language_mode()); |
| 103 } else if (scope_info->scope_type() == MODULE_SCOPE) { | 104 } else if (scope_info->scope_type() == MODULE_SCOPE) { |
| 104 info->set_module(); | 105 info->set_module(); |
| 105 } else { | 106 } else { |
| 106 DCHECK(scope_info->scope_type() == SCRIPT_SCOPE); | 107 DCHECK(scope_info->scope_type() == SCRIPT_SCOPE); |
| 107 } | 108 } |
| 108 } else { | 109 } else { |
| 109 // Inner function. | 110 // Inner function. |
| 110 info.reset(new ParseInfo(&zone, shared_info)); | 111 info.reset(new ParseInfo(&zone, shared_info)); |
| 111 } | 112 } |
| 112 if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) { | 113 if (parsing::ParseAny(info.get()) && Rewriter::Rewrite(info.get())) { |
| 113 DeclarationScope* scope = info->literal()->scope(); | 114 DeclarationScope* scope = info->literal()->scope(); |
| 114 if (!ignore_nested_scopes || collect_non_locals) { | 115 if (!ignore_nested_scopes || collect_non_locals) { |
| 115 CollectNonLocals(info.get(), scope); | 116 CollectNonLocals(info.get(), scope); |
| 116 } | 117 } |
| 117 if (!ignore_nested_scopes) { | 118 if (!ignore_nested_scopes) { |
| 118 DeclarationScope::Analyze(info.get(), AnalyzeMode::kDebugger); | 119 DeclarationScope::Analyze(info.get(), AnalyzeMode::kDebugger); |
| 119 RetrieveScopeChain(scope); | 120 RetrieveScopeChain(scope); |
| 120 } | 121 } |
| 121 } else { | 122 } else { |
| 122 // A failed reparse indicates that the preparser has diverged from the | 123 // A failed reparse indicates that the preparser has diverged from the |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 857 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
| 857 if (beg_pos <= position && position < end_pos) { | 858 if (beg_pos <= position && position < end_pos) { |
| 858 GetNestedScopeChain(isolate, inner_scope, position); | 859 GetNestedScopeChain(isolate, inner_scope, position); |
| 859 return; | 860 return; |
| 860 } | 861 } |
| 861 } | 862 } |
| 862 } | 863 } |
| 863 | 864 |
| 864 } // namespace internal | 865 } // namespace internal |
| 865 } // namespace v8 | 866 } // namespace v8 |
| OLD | NEW |