Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index 090a9d00e7318f05e80393dc37a72c046089a8aa..c489c69c969978d9f168982e0871d0dc931f3ef8 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -5932,7 +5932,14 @@ TEST(ModuleParsingInternals) { |
"export let hoo;" |
"export const joo = 42;" |
"export default (function koo() {});" |
- "import 'q.js'"; |
+ "import 'q.js';" |
+ "let nonexport = 42;" |
+ "import {m as mm} from 'm.js';" |
+ "import {aa} from 'm.js';" |
+ "export {aa as bb, x};" |
+ "import * as loo from 'bar.js';" |
+ "import * as foob from 'bar.js';" |
+ "export {foob};"; |
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource); |
i::Handle<i::Script> script = factory->NewScript(source); |
i::Zone zone(CcTest::i_isolate()->allocator()); |
@@ -5947,19 +5954,78 @@ TEST(ModuleParsingInternals) { |
CHECK(outer_scope->is_script_scope()); |
CHECK_NULL(outer_scope->outer_scope()); |
CHECK(module_scope->is_module_scope()); |
- i::ModuleDescriptor* descriptor = module_scope->module(); |
- CHECK_NOT_NULL(descriptor); |
i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); |
- CHECK_EQ(8, declarations->length()); |
+ |
CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x")); |
+ CHECK(declarations->at(0)->proxy()->var()->mode() == i::LET); |
+ CHECK(declarations->at(0)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
CHECK(declarations->at(1)->proxy()->raw_name()->IsOneByteEqualTo("z")); |
+ CHECK(declarations->at(1)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(1)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
CHECK(declarations->at(2)->proxy()->raw_name()->IsOneByteEqualTo("n")); |
+ CHECK(declarations->at(2)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(2)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
CHECK(declarations->at(3)->proxy()->raw_name()->IsOneByteEqualTo("foo")); |
+ CHECK(declarations->at(3)->proxy()->var()->mode() == i::VAR); |
+ CHECK(declarations->at(3)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
CHECK(declarations->at(4)->proxy()->raw_name()->IsOneByteEqualTo("goo")); |
+ CHECK(declarations->at(4)->proxy()->var()->mode() == i::LET); |
+ CHECK(declarations->at(4)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
CHECK(declarations->at(5)->proxy()->raw_name()->IsOneByteEqualTo("hoo")); |
+ CHECK(declarations->at(5)->proxy()->var()->mode() == i::LET); |
+ CHECK(declarations->at(5)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
CHECK(declarations->at(6)->proxy()->raw_name()->IsOneByteEqualTo("joo")); |
+ CHECK(declarations->at(6)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(6)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
CHECK( |
declarations->at(7)->proxy()->raw_name()->IsOneByteEqualTo("*default*")); |
+ CHECK(declarations->at(7)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(7)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
+ CHECK( |
+ declarations->at(8)->proxy()->raw_name()->IsOneByteEqualTo("nonexport")); |
+ CHECK(declarations->at(8)->proxy()->var()->location() != |
+ i::VariableLocation::MODULE); |
+ |
+ CHECK(declarations->at(9)->proxy()->raw_name()->IsOneByteEqualTo("mm")); |
+ CHECK(declarations->at(9)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(9)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
+ CHECK(declarations->at(10)->proxy()->raw_name()->IsOneByteEqualTo("aa")); |
+ CHECK(declarations->at(10)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(10)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
+ CHECK(declarations->at(11)->proxy()->raw_name()->IsOneByteEqualTo("loo")); |
+ CHECK(declarations->at(11)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(11)->proxy()->var()->location() != |
+ i::VariableLocation::MODULE); |
+ |
+ CHECK(declarations->at(12)->proxy()->raw_name()->IsOneByteEqualTo("foob")); |
+ CHECK(declarations->at(12)->proxy()->var()->mode() == i::CONST); |
+ CHECK(declarations->at(12)->proxy()->var()->location() == |
+ i::VariableLocation::MODULE); |
+ |
+ CHECK_EQ(13, declarations->length()); |
+ |
+ i::ModuleDescriptor* descriptor = module_scope->module(); |
+ CHECK_NOT_NULL(descriptor); |
// TODO(neis): Test more once we can inspect the imports/exports. |
} |