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

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

Issue 999893003: Modules: simplify logic around allocation of module internal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/scopes.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 12e1fe907ed558ad1564bf92f081521530e9ff84..c91c7b062bc4698142e1c2a38ad409f946f95914 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5220,6 +5220,8 @@ TEST(ImportExportParsingErrors) {
TEST(ModuleParsingInternals) {
+ i::FLAG_harmony_modules = true;
+
i::Isolate* isolate = CcTest::i_isolate();
i::Factory* factory = isolate->factory();
v8::HandleScope handles(CcTest::isolate());
@@ -5244,9 +5246,19 @@ TEST(ModuleParsingInternals) {
parser.set_allow_harmony_scoping(true);
info.set_module();
CHECK(parser.Parse(&info));
+ CHECK(i::Compiler::Analyze(&info));
+
i::FunctionLiteral* func = info.function();
- CHECK_EQ(i::MODULE_SCOPE, func->scope()->scope_type());
- i::ModuleDescriptor* descriptor = func->scope()->module();
+ i::Scope* module_scope = func->scope();
+ i::Scope* outer_scope = module_scope->outer_scope();
+ CHECK(outer_scope->is_script_scope());
+ CHECK_NULL(outer_scope->outer_scope());
+ CHECK_EQ(1, outer_scope->num_modules());
+ CHECK(module_scope->is_module_scope());
+ CHECK_NOT_NULL(module_scope->module_var());
+ CHECK_EQ(i::INTERNAL, module_scope->module_var()->mode());
+
+ i::ModuleDescriptor* descriptor = module_scope->module();
CHECK_NOT_NULL(descriptor);
CHECK_EQ(1, descriptor->Length());
const i::AstRawString* export_name = avf.GetOneByteString("y");
@@ -5254,7 +5266,7 @@ TEST(ModuleParsingInternals) {
descriptor->LookupLocalExport(export_name, &zone);
CHECK_NOT_NULL(local_name);
CHECK(local_name->IsOneByteEqualTo("x"));
- i::ZoneList<i::Declaration*>* declarations = func->scope()->declarations();
+ i::ZoneList<i::Declaration*>* declarations = module_scope->declarations();
CHECK_EQ(3, declarations->length());
CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x"));
i::ImportDeclaration* import_decl =
« no previous file with comments | « src/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698