OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/ast/context-slot-cache.h" | 7 #include "src/ast/context-slot-cache.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/ast/variables.h" | 9 #include "src/ast/variables.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
846 Handle<Object> module_request) { | 846 Handle<Object> module_request) { |
847 Handle<ModuleInfoEntry> result = isolate->factory()->NewModuleInfoEntry(); | 847 Handle<ModuleInfoEntry> result = isolate->factory()->NewModuleInfoEntry(); |
848 result->set(kExportNameIndex, *export_name); | 848 result->set(kExportNameIndex, *export_name); |
849 result->set(kLocalNameIndex, *local_name); | 849 result->set(kLocalNameIndex, *local_name); |
850 result->set(kImportNameIndex, *import_name); | 850 result->set(kImportNameIndex, *import_name); |
851 result->set(kModuleRequestIndex, *module_request); | 851 result->set(kModuleRequestIndex, *module_request); |
852 return result; | 852 return result; |
853 } | 853 } |
854 | 854 |
855 Handle<ModuleInfo> ModuleInfo::New(Isolate* isolate, ModuleDescriptor* descr) { | 855 Handle<ModuleInfo> ModuleInfo::New(Isolate* isolate, ModuleDescriptor* descr) { |
856 // Serialize module requests. | |
857 Handle<FixedArray> module_requests = isolate->factory()->NewFixedArray( | |
858 static_cast<int>(descr->module_requests().size())); | |
859 for (const auto& elem : descr->module_requests()) { | |
860 module_requests->set(static_cast<int>(elem.second), *elem.first->string()); | |
adamk
2016/09/19 19:57:20
You shouldn't need a static_cast here, isn't elem.
neis
2016/09/19 21:13:46
Yes, forgot to update.
| |
861 } | |
862 | |
856 // Serialize special exports. | 863 // Serialize special exports. |
857 Handle<FixedArray> special_exports = | 864 Handle<FixedArray> special_exports = |
858 isolate->factory()->NewFixedArray(descr->special_exports().length()); | 865 isolate->factory()->NewFixedArray(descr->special_exports().length()); |
859 { | 866 { |
860 int i = 0; | 867 int i = 0; |
861 for (auto entry : descr->special_exports()) { | 868 for (auto entry : descr->special_exports()) { |
862 special_exports->set(i++, *entry->Serialize(isolate)); | 869 special_exports->set(i++, *entry->Serialize(isolate)); |
863 } | 870 } |
864 } | 871 } |
865 | 872 |
866 // Serialize regular exports. | 873 // Serialize regular exports. |
867 Handle<FixedArray> regular_exports = isolate->factory()->NewFixedArray( | 874 Handle<FixedArray> regular_exports = isolate->factory()->NewFixedArray( |
868 static_cast<int>(descr->regular_exports().size())); | 875 static_cast<int>(descr->regular_exports().size())); |
869 { | 876 { |
870 int i = 0; | 877 int i = 0; |
871 for (const auto& it : descr->regular_exports()) { | 878 for (const auto& elem : descr->regular_exports()) { |
872 regular_exports->set(i++, *it.second->Serialize(isolate)); | 879 regular_exports->set(i++, *elem.second->Serialize(isolate)); |
873 } | 880 } |
874 } | 881 } |
875 | 882 |
876 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo(); | 883 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo(); |
884 result->set(kModuleRequestsIndex, *module_requests); | |
877 result->set(kSpecialExportsIndex, *special_exports); | 885 result->set(kSpecialExportsIndex, *special_exports); |
878 result->set(kRegularExportsIndex, *regular_exports); | 886 result->set(kRegularExportsIndex, *regular_exports); |
879 return result; | 887 return result; |
880 } | 888 } |
881 | 889 |
882 } // namespace internal | 890 } // namespace internal |
883 } // namespace v8 | 891 } // namespace v8 |
OLD | NEW |