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

Unified Diff: test/cctest/test-parsing.cc

Issue 2273013002: [modules] Split exports into regular and special, store regular ones in a multimap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git cl format Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/zone-containers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index c73341c77f584732ccec16ac76d65d3df8a1118c..627d4cb4f0ebe3d4d90acb4ba590db1018cb568f 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5852,22 +5852,22 @@ static void CheckModuleEntry(const i::ModuleDescriptor::ModuleEntry* entry,
if (export_name == nullptr) {
CHECK_NULL(entry->export_name);
} else {
- entry->export_name->IsOneByteEqualTo(export_name);
+ CHECK(entry->export_name->IsOneByteEqualTo(export_name));
}
if (local_name == nullptr) {
CHECK_NULL(entry->local_name);
} else {
- entry->local_name->IsOneByteEqualTo(local_name);
+ CHECK(entry->local_name->IsOneByteEqualTo(local_name));
}
if (import_name == nullptr) {
CHECK_NULL(entry->import_name);
} else {
- entry->import_name->IsOneByteEqualTo(import_name);
+ CHECK(entry->import_name->IsOneByteEqualTo(import_name));
}
if (module_request == nullptr) {
CHECK_NULL(entry->module_request);
} else {
- entry->module_request->IsOneByteEqualTo(module_request);
+ CHECK(entry->module_request->IsOneByteEqualTo(module_request));
}
}
@@ -5914,6 +5914,7 @@ TEST(ModuleParsingInternals) {
CHECK(outer_scope->is_script_scope());
CHECK_NULL(outer_scope->outer_scope());
CHECK(module_scope->is_module_scope());
+ const i::ModuleDescriptor::ModuleEntry* entry;
i::ZoneList<i::Declaration*>* declarations = module_scope->declarations();
CHECK_EQ(13, declarations->length());
@@ -5999,29 +6000,53 @@ TEST(ModuleParsingInternals) {
i::ModuleDescriptor* descriptor = module_scope->module();
CHECK_NOT_NULL(descriptor);
- CHECK_EQ(11, descriptor->exports().length());
- CheckModuleEntry(
- descriptor->exports().at(0), "y", "x", nullptr, nullptr);
- CheckModuleEntry(
- descriptor->exports().at(1), "b", nullptr, "a", "m.js");
- CheckModuleEntry(
- descriptor->exports().at(2), nullptr, nullptr, nullptr, "p.js");
- CheckModuleEntry(
- descriptor->exports().at(3), "foo", "foo", nullptr, nullptr);
- CheckModuleEntry(
- descriptor->exports().at(4), "goo", "goo", nullptr, nullptr);
- CheckModuleEntry(
- descriptor->exports().at(5), "hoo", "hoo", nullptr, nullptr);
- CheckModuleEntry(
- descriptor->exports().at(6), "joo", "joo", nullptr, nullptr);
- CheckModuleEntry(
- descriptor->exports().at(7), "default", "*default*", nullptr, nullptr);
- CheckModuleEntry(
- descriptor->exports().at(8), "bb", nullptr, "aa", "m.js"); // !!!
- CheckModuleEntry(
- descriptor->exports().at(9), "x", "x", nullptr, nullptr);
- CheckModuleEntry(
- descriptor->exports().at(10), "foob", "foob", nullptr, nullptr);
+ CHECK_EQ(3, descriptor->special_exports().length());
+ CheckModuleEntry(descriptor->special_exports().at(0), "b", nullptr, "a",
+ "m.js");
+ CheckModuleEntry(descriptor->special_exports().at(1), nullptr, nullptr,
+ nullptr, "p.js");
+ CheckModuleEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa",
+ "m.js"); // !!!
+
+ CHECK_EQ(8, descriptor->regular_exports().size());
+ entry = descriptor->regular_exports()
+ .find(declarations->at(3)->proxy()->raw_name())
+ ->second;
+ CheckModuleEntry(entry, "foo", "foo", nullptr, nullptr);
+ entry = descriptor->regular_exports()
+ .find(declarations->at(4)->proxy()->raw_name())
+ ->second;
+ CheckModuleEntry(entry, "goo", "goo", nullptr, nullptr);
+ entry = descriptor->regular_exports()
+ .find(declarations->at(5)->proxy()->raw_name())
+ ->second;
+ CheckModuleEntry(entry, "hoo", "hoo", nullptr, nullptr);
+ entry = descriptor->regular_exports()
+ .find(declarations->at(6)->proxy()->raw_name())
+ ->second;
+ CheckModuleEntry(entry, "joo", "joo", nullptr, nullptr);
+ entry = descriptor->regular_exports()
+ .find(declarations->at(7)->proxy()->raw_name())
+ ->second;
+ CheckModuleEntry(entry, "default", "*default*", nullptr, nullptr);
+ entry = descriptor->regular_exports()
+ .find(declarations->at(12)->proxy()->raw_name())
+ ->second;
+ CheckModuleEntry(entry, "foob", "foob", nullptr, nullptr);
+ // TODO(neis): The next lines are terrible. Find a better way.
+ auto name_x = declarations->at(0)->proxy()->raw_name();
+ CHECK_EQ(2, descriptor->regular_exports().count(name_x));
+ auto it = descriptor->regular_exports().equal_range(name_x).first;
+ entry = it->second;
+ if (entry->export_name->IsOneByteEqualTo("y")) {
+ CheckModuleEntry(entry, "y", "x", nullptr, nullptr);
+ entry = (++it)->second;
+ CheckModuleEntry(entry, "x", "x", nullptr, nullptr);
+ } else {
+ CheckModuleEntry(entry, "x", "x", nullptr, nullptr);
+ entry = (++it)->second;
+ CheckModuleEntry(entry, "y", "x", nullptr, nullptr);
+ }
CHECK_EQ(3, descriptor->special_imports().length());
CheckModuleEntry(
@@ -6032,7 +6057,6 @@ TEST(ModuleParsingInternals) {
descriptor->special_imports().at(2), nullptr, "foob", nullptr, "bar.js");
CHECK_EQ(4, descriptor->regular_imports().size());
- const i::ModuleDescriptor::ModuleEntry* entry;
entry = descriptor->regular_imports().find(
declarations->at(1)->proxy()->raw_name())->second;
CheckModuleEntry(entry, nullptr, "z", "q", "m.js");
« no previous file with comments | « src/zone-containers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698