| 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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 i::Handle<i::Script> script = factory->NewScript(source); | 1182 i::Handle<i::Script> script = factory->NewScript(source); |
| 1183 i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); | 1183 i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); |
| 1184 i::ParseInfo info(&zone, script); | 1184 i::ParseInfo info(&zone, script); |
| 1185 info.set_language_mode(source_data[i].language_mode); | 1185 info.set_language_mode(source_data[i].language_mode); |
| 1186 i::parsing::ParseProgram(&info); | 1186 i::parsing::ParseProgram(&info); |
| 1187 CHECK_NOT_NULL(info.literal()); | 1187 CHECK_NOT_NULL(info.literal()); |
| 1188 | 1188 |
| 1189 // Check scope types and positions. | 1189 // Check scope types and positions. |
| 1190 i::Scope* scope = info.literal()->scope(); | 1190 i::Scope* scope = info.literal()->scope(); |
| 1191 CHECK(scope->is_script_scope()); | 1191 CHECK(scope->is_script_scope()); |
| 1192 CHECK_EQ(scope->start_position(), 0); | 1192 CHECK_EQ(0, scope->start_position()); |
| 1193 CHECK_EQ(scope->end_position(), kProgramSize); | 1193 CHECK_EQ(scope->end_position(), kProgramSize); |
| 1194 | 1194 |
| 1195 i::Scope* inner_scope = scope->inner_scope(); | 1195 i::Scope* inner_scope = scope->inner_scope(); |
| 1196 DCHECK_NOT_NULL(inner_scope); | 1196 DCHECK_NOT_NULL(inner_scope); |
| 1197 DCHECK_NULL(inner_scope->sibling()); | 1197 DCHECK_NULL(inner_scope->sibling()); |
| 1198 CHECK_EQ(inner_scope->scope_type(), source_data[i].scope_type); | 1198 CHECK_EQ(inner_scope->scope_type(), source_data[i].scope_type); |
| 1199 CHECK_EQ(inner_scope->start_position(), kPrefixLen); | 1199 CHECK_EQ(inner_scope->start_position(), kPrefixLen); |
| 1200 // The end position of a token is one position after the last | 1200 // The end position of a token is one position after the last |
| 1201 // character belonging to that token. | 1201 // character belonging to that token. |
| 1202 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen); | 1202 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen); |
| (...skipping 5257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6460 CHECK(!declarations->AtForTest(12)->proxy()->var()->binding_needs_init()); | 6460 CHECK(!declarations->AtForTest(12)->proxy()->var()->binding_needs_init()); |
| 6461 CHECK(declarations->AtForTest(12)->proxy()->var()->location() == | 6461 CHECK(declarations->AtForTest(12)->proxy()->var()->location() == |
| 6462 i::VariableLocation::MODULE); | 6462 i::VariableLocation::MODULE); |
| 6463 | 6463 |
| 6464 i::ModuleDescriptor* descriptor = module_scope->module(); | 6464 i::ModuleDescriptor* descriptor = module_scope->module(); |
| 6465 CHECK_NOT_NULL(descriptor); | 6465 CHECK_NOT_NULL(descriptor); |
| 6466 | 6466 |
| 6467 CHECK_EQ(5u, descriptor->module_requests().size()); | 6467 CHECK_EQ(5u, descriptor->module_requests().size()); |
| 6468 for (const auto& elem : descriptor->module_requests()) { | 6468 for (const auto& elem : descriptor->module_requests()) { |
| 6469 if (elem.first->IsOneByteEqualTo("m.js")) | 6469 if (elem.first->IsOneByteEqualTo("m.js")) |
| 6470 CHECK_EQ(elem.second, 0); | 6470 CHECK_EQ(0, elem.second); |
| 6471 else if (elem.first->IsOneByteEqualTo("n.js")) | 6471 else if (elem.first->IsOneByteEqualTo("n.js")) |
| 6472 CHECK_EQ(elem.second, 1); | 6472 CHECK_EQ(1, elem.second); |
| 6473 else if (elem.first->IsOneByteEqualTo("p.js")) | 6473 else if (elem.first->IsOneByteEqualTo("p.js")) |
| 6474 CHECK_EQ(elem.second, 2); | 6474 CHECK_EQ(2, elem.second); |
| 6475 else if (elem.first->IsOneByteEqualTo("q.js")) | 6475 else if (elem.first->IsOneByteEqualTo("q.js")) |
| 6476 CHECK_EQ(elem.second, 3); | 6476 CHECK_EQ(3, elem.second); |
| 6477 else if (elem.first->IsOneByteEqualTo("bar.js")) | 6477 else if (elem.first->IsOneByteEqualTo("bar.js")) |
| 6478 CHECK_EQ(elem.second, 4); | 6478 CHECK_EQ(4, elem.second); |
| 6479 else | 6479 else |
| 6480 CHECK(false); | 6480 CHECK(false); |
| 6481 } | 6481 } |
| 6482 | 6482 |
| 6483 CHECK_EQ(3, descriptor->special_exports().length()); | 6483 CHECK_EQ(3, descriptor->special_exports().length()); |
| 6484 CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0); | 6484 CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0); |
| 6485 CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2); | 6485 CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2); |
| 6486 CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa", | 6486 CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa", |
| 6487 0); // !!! | 6487 0); // !!! |
| 6488 | 6488 |
| (...skipping 3039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9528 eager_info.literal()->scope()->inner_scope()->inner_scope(); | 9528 eager_info.literal()->scope()->inner_scope()->inner_scope(); |
| 9529 DCHECK_NOT_NULL(scope); | 9529 DCHECK_NOT_NULL(scope); |
| 9530 DCHECK_NULL(scope->sibling()); | 9530 DCHECK_NULL(scope->sibling()); |
| 9531 DCHECK(scope->is_function_scope()); | 9531 DCHECK(scope->is_function_scope()); |
| 9532 | 9532 |
| 9533 size_t index = 0; | 9533 size_t index = 0; |
| 9534 i::ScopeTestHelper::CompareScopeToData( | 9534 i::ScopeTestHelper::CompareScopeToData( |
| 9535 scope, lazy_info.preparsed_scope_data(), index); | 9535 scope, lazy_info.preparsed_scope_data(), index); |
| 9536 } | 9536 } |
| 9537 } | 9537 } |
| OLD | NEW |