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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Global or eval code. | 90 // Global or eval code. |
91 Handle<Script> script(Script::cast(shared_info->script())); | 91 Handle<Script> script(Script::cast(shared_info->script())); |
92 info.Reset(new ParseInfo(&zone, script)); | 92 info.Reset(new ParseInfo(&zone, script)); |
93 info->set_toplevel(); | 93 info->set_toplevel(); |
94 if (scope_info->scope_type() == SCRIPT_SCOPE) { | 94 if (scope_info->scope_type() == SCRIPT_SCOPE) { |
95 info->set_global(); | 95 info->set_global(); |
96 } else { | 96 } else { |
97 DCHECK(scope_info->scope_type() == EVAL_SCOPE); | 97 DCHECK(scope_info->scope_type() == EVAL_SCOPE); |
98 info->set_eval(); | 98 info->set_eval(); |
99 info->set_context(Handle<Context>(function->context())); | 99 info->set_context(Handle<Context>(function->context())); |
| 100 // Language mode may be inherited from the eval caller. |
| 101 // Retrieve it from shared function info. |
| 102 info->set_language_mode(shared_info->language_mode()); |
100 } | 103 } |
101 } else { | 104 } else { |
102 // Inner function. | 105 // Inner function. |
103 info.Reset(new ParseInfo(&zone, function)); | 106 info.Reset(new ParseInfo(&zone, function)); |
104 } | 107 } |
105 Scope* scope = NULL; | 108 Scope* scope = NULL; |
106 if (Compiler::ParseAndAnalyze(info.get())) scope = info->literal()->scope(); | 109 if (Compiler::ParseAndAnalyze(info.get())) scope = info->literal()->scope(); |
107 if (!ignore_nested_scopes) RetrieveScopeChain(scope); | 110 if (!ignore_nested_scopes) RetrieveScopeChain(scope); |
108 if (collect_non_locals) CollectNonLocals(scope); | 111 if (collect_non_locals) CollectNonLocals(scope); |
109 UnwrapEvaluationContext(); | 112 UnwrapEvaluationContext(); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 806 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
804 if (beg_pos <= position && position < end_pos) { | 807 if (beg_pos <= position && position < end_pos) { |
805 GetNestedScopeChain(isolate, inner_scope, position); | 808 GetNestedScopeChain(isolate, inner_scope, position); |
806 return; | 809 return; |
807 } | 810 } |
808 } | 811 } |
809 } | 812 } |
810 | 813 |
811 } // namespace internal | 814 } // namespace internal |
812 } // namespace v8 | 815 } // namespace v8 |
OLD | NEW |