Chromium Code Reviews| 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/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 ->value(); | 794 ->value(); |
| 795 for (int i = 0; i < module_variable_count; ++i) { | 795 for (int i = 0; i < module_variable_count; ++i) { |
| 796 Handle<String> local_name; | 796 Handle<String> local_name; |
| 797 bool is_export; | 797 bool is_export; |
| 798 { | 798 { |
| 799 String* name; | 799 String* name; |
| 800 int index; | 800 int index; |
| 801 scope_info->ModuleVariable(i, &name, &index); | 801 scope_info->ModuleVariable(i, &name, &index); |
| 802 CHECK(!ScopeInfo::VariableIsSynthetic(name)); | 802 CHECK(!ScopeInfo::VariableIsSynthetic(name)); |
| 803 local_name = handle(name, isolate); | 803 local_name = handle(name, isolate); |
| 804 is_export = index == Variable::kModuleExportIndex; | 804 DCHECK_NE(index, 0); |
| 805 is_export = index > 0; | |
|
adamk
2016/10/31 18:25:04
Comparisons like these getting added in various pl
neis
2016/11/03 10:43:48
It's already in Variable (IsExport), but here we d
| |
| 805 } | 806 } |
| 806 | 807 |
| 807 Handle<Object> value; | 808 Handle<Object> value; |
| 808 if (is_export) { | 809 if (is_export) { |
| 809 value = | 810 value = |
| 810 Module::LoadExport(handle(context->module(), isolate), local_name); | 811 Module::LoadExport(handle(context->module(), isolate), local_name); |
| 811 } else { | 812 } else { |
| 812 Handle<ModuleInfo> module_info(scope_info->ModuleDescriptorInfo(), | 813 Handle<ModuleInfo> module_info(scope_info->ModuleDescriptorInfo(), |
| 813 isolate); | 814 isolate); |
| 814 Handle<ModuleInfoEntry> entry = | 815 Handle<ModuleInfoEntry> entry = |
| 815 ModuleInfo::LookupRegularImport(module_info, local_name); | 816 ModuleInfo::LookupRegularImport(module_info, local_name); |
| 816 Handle<String> import_name(String::cast(entry->import_name()), isolate); | 817 Handle<String> import_name(String::cast(entry->import_name()), isolate); |
| 817 int module_request = Smi::cast(entry->module_request())->value(); | |
| 818 value = Module::LoadImport(handle(context->module(), isolate), | 818 value = Module::LoadImport(handle(context->module(), isolate), |
| 819 import_name, module_request); | 819 import_name, entry->module_request()); |
| 820 } | 820 } |
| 821 | 821 |
| 822 // Reflect variables under TDZ as undefined in scope object. | 822 // Reflect variables under TDZ as undefined in scope object. |
| 823 if (value->IsTheHole(isolate)) continue; | 823 if (value->IsTheHole(isolate)) continue; |
| 824 // This should always succeed. | 824 // This should always succeed. |
| 825 // TODO(verwaest): Use AddDataProperty instead. | 825 // TODO(verwaest): Use AddDataProperty instead. |
| 826 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, local_name, value, | 826 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, local_name, value, |
| 827 NONE) | 827 NONE) |
| 828 .Check(); | 828 .Check(); |
| 829 } | 829 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 871 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 871 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
| 872 if (beg_pos <= position && position < end_pos) { | 872 if (beg_pos <= position && position < end_pos) { |
| 873 GetNestedScopeChain(isolate, inner_scope, position); | 873 GetNestedScopeChain(isolate, inner_scope, position); |
| 874 return; | 874 return; |
| 875 } | 875 } |
| 876 } | 876 } |
| 877 } | 877 } |
| 878 | 878 |
| 879 } // namespace internal | 879 } // namespace internal |
| 880 } // namespace v8 | 880 } // namespace v8 |
| OLD | NEW |