OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5744 i::ParseInfo info(&zone, script); | 5744 i::ParseInfo info(&zone, script); |
5745 i::Parser parser(&info); | 5745 i::Parser parser(&info); |
5746 info.set_module(); | 5746 info.set_module(); |
5747 CHECK(parser.Parse(&info)); | 5747 CHECK(parser.Parse(&info)); |
5748 CHECK(i::Compiler::Analyze(&info)); | 5748 CHECK(i::Compiler::Analyze(&info)); |
5749 i::FunctionLiteral* func = info.literal(); | 5749 i::FunctionLiteral* func = info.literal(); |
5750 i::Scope* module_scope = func->scope(); | 5750 i::Scope* module_scope = func->scope(); |
5751 i::Scope* outer_scope = module_scope->outer_scope(); | 5751 i::Scope* outer_scope = module_scope->outer_scope(); |
5752 CHECK(outer_scope->is_script_scope()); | 5752 CHECK(outer_scope->is_script_scope()); |
5753 CHECK_NULL(outer_scope->outer_scope()); | 5753 CHECK_NULL(outer_scope->outer_scope()); |
5754 CHECK_EQ(1, outer_scope->num_modules()); | |
5755 CHECK(module_scope->is_module_scope()); | 5754 CHECK(module_scope->is_module_scope()); |
5756 CHECK_NOT_NULL(module_scope->module_var()); | |
5757 CHECK_EQ(i::TEMPORARY, module_scope->module_var()->mode()); | |
5758 i::ModuleDescriptor* descriptor = module_scope->module(); | 5755 i::ModuleDescriptor* descriptor = module_scope->module(); |
5759 CHECK_NOT_NULL(descriptor); | 5756 CHECK_NOT_NULL(descriptor); |
5760 CHECK_EQ(1, descriptor->Length()); | 5757 CHECK_EQ(1, descriptor->Length()); |
5761 const i::AstRawString* export_name = | 5758 const i::AstRawString* export_name = |
5762 info.ast_value_factory()->GetOneByteString("y"); | 5759 info.ast_value_factory()->GetOneByteString("y"); |
5763 const i::AstRawString* local_name = | 5760 const i::AstRawString* local_name = |
5764 descriptor->LookupLocalExport(export_name, &zone); | 5761 descriptor->LookupLocalExport(export_name, &zone); |
5765 CHECK_NOT_NULL(local_name); | 5762 CHECK_NOT_NULL(local_name); |
5766 CHECK(local_name->IsOneByteEqualTo("x")); | 5763 CHECK(local_name->IsOneByteEqualTo("x")); |
5767 i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); | 5764 i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7479 "var publ\\u0069c = 1;", | 7476 "var publ\\u0069c = 1;", |
7480 "var { publ\\u0069c } = {};", | 7477 "var { publ\\u0069c } = {};", |
7481 NULL}; | 7478 NULL}; |
7482 RunParserSyncTest(sloppy_context_data, valid_data, kSuccess, NULL, 0, | 7479 RunParserSyncTest(sloppy_context_data, valid_data, kSuccess, NULL, 0, |
7483 always_flags, arraysize(always_flags)); | 7480 always_flags, arraysize(always_flags)); |
7484 RunParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, | 7481 RunParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, |
7485 always_flags, arraysize(always_flags)); | 7482 always_flags, arraysize(always_flags)); |
7486 RunModuleParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, | 7483 RunModuleParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, |
7487 always_flags, arraysize(always_flags)); | 7484 always_flags, arraysize(always_flags)); |
7488 } | 7485 } |
OLD | NEW |