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

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

Issue 960793003: Allow lookup of module exports by export name. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/modules.cc ('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 02f8869c419fc4c70504c2ac87fa1cf8fe3e7ee3..fcc096af850221fe94e38828049f6036f58364ac 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5223,6 +5223,8 @@ TEST(ModuleParsingInternals) {
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source);
i::CompilationInfoWithZone info(script);
+ i::Zone* zone = info.zone();
+ i::AstValueFactory avf(zone, isolate->heap()->HashSeed());
i::Parser parser(&info, isolate->stack_guard()->real_climit(),
isolate->heap()->HashSeed(), isolate->unicode_cache());
parser.set_allow_harmony_modules(true);
@@ -5233,13 +5235,12 @@ TEST(ModuleParsingInternals) {
CHECK_EQ(i::MODULE_SCOPE, func->scope()->scope_type());
i::ModuleDescriptor* descriptor = func->scope()->module();
CHECK_NOT_NULL(descriptor);
- int num_exports = 0;
- for (auto it = descriptor->iterator(); !it.done(); it.Advance()) {
- ++num_exports;
- CHECK(it.local_name()->IsOneByteEqualTo("x"));
- CHECK(it.export_name()->IsOneByteEqualTo("y"));
- }
- CHECK_EQ(1, num_exports);
+ CHECK_EQ(1, descriptor->Length());
+ const i::AstRawString* export_name = avf.GetOneByteString("y");
+ const i::AstRawString* local_name =
+ descriptor->LookupLocalExport(export_name, zone);
+ CHECK_NOT_NULL(local_name);
+ CHECK(local_name->IsOneByteEqualTo("x"));
i::ZoneList<i::Declaration*>* declarations = func->scope()->declarations();
CHECK_EQ(2, declarations->length());
CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x"));
« no previous file with comments | « src/modules.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698