Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/ast/scopeinfo.cc

Issue 2368613002: [modules] Simplify treatment of empty imports. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/modules.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 // Serialize special exports. 864 // Serialize special exports.
865 Handle<FixedArray> special_exports = 865 Handle<FixedArray> special_exports =
866 isolate->factory()->NewFixedArray(descr->special_exports().length()); 866 isolate->factory()->NewFixedArray(descr->special_exports().length());
867 { 867 {
868 int i = 0; 868 int i = 0;
869 for (auto entry : descr->special_exports()) { 869 for (auto entry : descr->special_exports()) {
870 special_exports->set(i++, *entry->Serialize(isolate)); 870 special_exports->set(i++, *entry->Serialize(isolate));
871 } 871 }
872 } 872 }
873 873
874 // Serialize special imports. 874 // Serialize namespace imports.
875 Handle<FixedArray> special_imports = 875 Handle<FixedArray> namespace_imports =
876 isolate->factory()->NewFixedArray(descr->special_imports().length()); 876 isolate->factory()->NewFixedArray(descr->namespace_imports().length());
877 { 877 {
878 int i = 0; 878 int i = 0;
879 for (auto entry : descr->special_imports()) { 879 for (auto entry : descr->namespace_imports()) {
880 special_imports->set(i++, *entry->Serialize(isolate)); 880 namespace_imports->set(i++, *entry->Serialize(isolate));
881 } 881 }
882 } 882 }
883 883
884 // Serialize regular exports. 884 // Serialize regular exports.
885 Handle<FixedArray> regular_exports = 885 Handle<FixedArray> regular_exports =
886 descr->SerializeRegularExports(isolate, zone); 886 descr->SerializeRegularExports(isolate, zone);
887 887
888 // Serialize regular imports. 888 // Serialize regular imports.
889 Handle<FixedArray> regular_imports = isolate->factory()->NewFixedArray( 889 Handle<FixedArray> regular_imports = isolate->factory()->NewFixedArray(
890 static_cast<int>(descr->regular_imports().size())); 890 static_cast<int>(descr->regular_imports().size()));
891 { 891 {
892 int i = 0; 892 int i = 0;
893 for (const auto& elem : descr->regular_imports()) { 893 for (const auto& elem : descr->regular_imports()) {
894 regular_imports->set(i++, *elem.second->Serialize(isolate)); 894 regular_imports->set(i++, *elem.second->Serialize(isolate));
895 } 895 }
896 } 896 }
897 897
898 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo(); 898 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo();
899 result->set(kModuleRequestsIndex, *module_requests); 899 result->set(kModuleRequestsIndex, *module_requests);
900 result->set(kSpecialExportsIndex, *special_exports); 900 result->set(kSpecialExportsIndex, *special_exports);
901 result->set(kRegularExportsIndex, *regular_exports); 901 result->set(kRegularExportsIndex, *regular_exports);
902 result->set(kSpecialImportsIndex, *special_imports); 902 result->set(kNamespaceImportsIndex, *namespace_imports);
903 result->set(kRegularImportsIndex, *regular_imports); 903 result->set(kRegularImportsIndex, *regular_imports);
904 return result; 904 return result;
905 } 905 }
906 906
907 } // namespace internal 907 } // namespace internal
908 } // namespace v8 908 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/modules.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698