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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2457393003: Thread decls-list through Declaration (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « test/cctest/asmjs/test-asm-typer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 903
904 i::Handle<i::Script> script = factory->NewScript(source_code); 904 i::Handle<i::Script> script = factory->NewScript(source_code);
905 905
906 i::ParseInfo info(handles.main_zone(), script); 906 i::ParseInfo info(handles.main_zone(), script);
907 i::Parser parser(&info); 907 i::Parser parser(&info);
908 info.set_allow_lazy_parsing(false); 908 info.set_allow_lazy_parsing(false);
909 info.set_toplevel(true); 909 info.set_toplevel(true);
910 910
911 CHECK(i::Compiler::ParseAndAnalyze(&info)); 911 CHECK(i::Compiler::ParseAndAnalyze(&info));
912 912
913 CHECK(info.scope()->declarations()->length() == 1); 913 CHECK_EQ(1, info.scope()->declarations()->LengthForTest());
914 i::FunctionLiteral* fun = 914 i::Declaration* decl = info.scope()->declarations()->AtForTest(0);
915 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); 915 i::FunctionLiteral* fun = decl->AsFunctionDeclaration()->fun();
916 CHECK(fun->body()->length() == 1); 916 CHECK(fun->body()->length() == 1);
917 CHECK(fun->body()->at(0)->IsReturnStatement()); 917 CHECK(fun->body()->at(0)->IsReturnStatement());
918 i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement(); 918 i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement();
919 i::Literal* lit = ret->expression()->AsLiteral(); 919 i::Literal* lit = ret->expression()->AsLiteral();
920 if (lit != NULL) { 920 if (lit != NULL) {
921 const i::AstValue* val = lit->raw_value(); 921 const i::AstValue* val = lit->raw_value();
922 CHECK(with_dot == val->ContainsDot()); 922 CHECK(with_dot == val->ContainsDot());
923 } else if (with_dot) { 923 } else if (with_dot) {
924 i::BinaryOperation* bin = ret->expression()->AsBinaryOperation(); 924 i::BinaryOperation* bin = ret->expression()->AsBinaryOperation();
925 CHECK(bin != NULL); 925 CHECK(bin != NULL);
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 parser.Parse(&info); 1220 parser.Parse(&info);
1221 function = info.literal(); 1221 function = info.literal();
1222 CHECK_NOT_NULL(function); 1222 CHECK_NOT_NULL(function);
1223 CHECK_NOT_NULL(function->body()); 1223 CHECK_NOT_NULL(function->body());
1224 CHECK_EQ(1, function->body()->length()); 1224 CHECK_EQ(1, function->body()->length());
1225 i::FunctionLiteral* inner = 1225 i::FunctionLiteral* inner =
1226 function->body()->first()->AsExpressionStatement()->expression()-> 1226 function->body()->first()->AsExpressionStatement()->expression()->
1227 AsCall()->expression()->AsFunctionLiteral(); 1227 AsCall()->expression()->AsFunctionLiteral();
1228 i::Scope* inner_scope = inner->scope(); 1228 i::Scope* inner_scope = inner->scope();
1229 i::FunctionLiteral* fun = nullptr; 1229 i::FunctionLiteral* fun = nullptr;
1230 if (inner_scope->declarations()->length() > 0) { 1230 if (!inner_scope->declarations()->is_empty()) {
1231 fun = inner_scope->declarations()->at(0)->AsFunctionDeclaration()->fun(); 1231 fun = inner_scope->declarations()
1232 ->AtForTest(0)
1233 ->AsFunctionDeclaration()
1234 ->fun();
1232 } else { 1235 } else {
1233 // TODO(conradw): This path won't be hit until the other test cases can be 1236 // TODO(conradw): This path won't be hit until the other test cases can be
1234 // uncommented. 1237 // uncommented.
1235 UNREACHABLE(); 1238 UNREACHABLE();
1236 CHECK_NOT_NULL(inner->body()); 1239 CHECK_NOT_NULL(inner->body());
1237 CHECK_GE(2, inner->body()->length()); 1240 CHECK_GE(2, inner->body()->length());
1238 i::Expression* exp = inner->body()->at(1)->AsExpressionStatement()-> 1241 i::Expression* exp = inner->body()->at(1)->AsExpressionStatement()->
1239 expression()->AsBinaryOperation()->right(); 1242 expression()->AsBinaryOperation()->right();
1240 if (exp->IsFunctionLiteral()) { 1243 if (exp->IsFunctionLiteral()) {
1241 fun = exp->AsFunctionLiteral(); 1244 fun = exp->AsFunctionLiteral();
(...skipping 4769 matching lines...) Expand 10 before | Expand all | Expand 10 after
6011 info.set_module(); 6014 info.set_module();
6012 CHECK(parser.Parse(&info)); 6015 CHECK(parser.Parse(&info));
6013 CHECK(i::Compiler::Analyze(&info)); 6016 CHECK(i::Compiler::Analyze(&info));
6014 i::FunctionLiteral* func = info.literal(); 6017 i::FunctionLiteral* func = info.literal();
6015 i::ModuleScope* module_scope = func->scope()->AsModuleScope(); 6018 i::ModuleScope* module_scope = func->scope()->AsModuleScope();
6016 i::Scope* outer_scope = module_scope->outer_scope(); 6019 i::Scope* outer_scope = module_scope->outer_scope();
6017 CHECK(outer_scope->is_script_scope()); 6020 CHECK(outer_scope->is_script_scope());
6018 CHECK_NULL(outer_scope->outer_scope()); 6021 CHECK_NULL(outer_scope->outer_scope());
6019 CHECK(module_scope->is_module_scope()); 6022 CHECK(module_scope->is_module_scope());
6020 const i::ModuleDescriptor::Entry* entry; 6023 const i::ModuleDescriptor::Entry* entry;
6021 i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); 6024 i::Declaration::List* declarations = module_scope->declarations();
6022 CHECK_EQ(13, declarations->length()); 6025 CHECK_EQ(13, declarations->LengthForTest());
6023 6026
6024 CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x")); 6027 CHECK(declarations->AtForTest(0)->proxy()->raw_name()->IsOneByteEqualTo("x"));
6025 CHECK(declarations->at(0)->proxy()->var()->mode() == i::LET); 6028 CHECK(declarations->AtForTest(0)->proxy()->var()->mode() == i::LET);
6026 CHECK(declarations->at(0)->proxy()->var()->binding_needs_init()); 6029 CHECK(declarations->AtForTest(0)->proxy()->var()->binding_needs_init());
6027 CHECK(declarations->at(0)->proxy()->var()->location() == 6030 CHECK(declarations->AtForTest(0)->proxy()->var()->location() ==
6028 i::VariableLocation::MODULE); 6031 i::VariableLocation::MODULE);
6029 6032
6030 CHECK(declarations->at(1)->proxy()->raw_name()->IsOneByteEqualTo("z")); 6033 CHECK(declarations->AtForTest(1)->proxy()->raw_name()->IsOneByteEqualTo("z"));
6031 CHECK(declarations->at(1)->proxy()->var()->mode() == i::CONST); 6034 CHECK(declarations->AtForTest(1)->proxy()->var()->mode() == i::CONST);
6032 CHECK(declarations->at(1)->proxy()->var()->binding_needs_init()); 6035 CHECK(declarations->AtForTest(1)->proxy()->var()->binding_needs_init());
6033 CHECK(declarations->at(1)->proxy()->var()->location() == 6036 CHECK(declarations->AtForTest(1)->proxy()->var()->location() ==
6034 i::VariableLocation::MODULE); 6037 i::VariableLocation::MODULE);
6035 6038
6036 CHECK(declarations->at(2)->proxy()->raw_name()->IsOneByteEqualTo("n")); 6039 CHECK(declarations->AtForTest(2)->proxy()->raw_name()->IsOneByteEqualTo("n"));
6037 CHECK(declarations->at(2)->proxy()->var()->mode() == i::CONST); 6040 CHECK(declarations->AtForTest(2)->proxy()->var()->mode() == i::CONST);
6038 CHECK(declarations->at(2)->proxy()->var()->binding_needs_init()); 6041 CHECK(declarations->AtForTest(2)->proxy()->var()->binding_needs_init());
6039 CHECK(declarations->at(2)->proxy()->var()->location() == 6042 CHECK(declarations->AtForTest(2)->proxy()->var()->location() ==
6040 i::VariableLocation::MODULE);
6041
6042 CHECK(declarations->at(3)->proxy()->raw_name()->IsOneByteEqualTo("foo"));
6043 CHECK(declarations->at(3)->proxy()->var()->mode() == i::VAR);
6044 CHECK(!declarations->at(3)->proxy()->var()->binding_needs_init());
6045 CHECK(declarations->at(3)->proxy()->var()->location() ==
6046 i::VariableLocation::MODULE);
6047
6048 CHECK(declarations->at(4)->proxy()->raw_name()->IsOneByteEqualTo("goo"));
6049 CHECK(declarations->at(4)->proxy()->var()->mode() == i::LET);
6050 CHECK(!declarations->at(4)->proxy()->var()->binding_needs_init());
6051 CHECK(declarations->at(4)->proxy()->var()->location() ==
6052 i::VariableLocation::MODULE);
6053
6054 CHECK(declarations->at(5)->proxy()->raw_name()->IsOneByteEqualTo("hoo"));
6055 CHECK(declarations->at(5)->proxy()->var()->mode() == i::LET);
6056 CHECK(declarations->at(5)->proxy()->var()->binding_needs_init());
6057 CHECK(declarations->at(5)->proxy()->var()->location() ==
6058 i::VariableLocation::MODULE);
6059
6060 CHECK(declarations->at(6)->proxy()->raw_name()->IsOneByteEqualTo("joo"));
6061 CHECK(declarations->at(6)->proxy()->var()->mode() == i::CONST);
6062 CHECK(declarations->at(6)->proxy()->var()->binding_needs_init());
6063 CHECK(declarations->at(6)->proxy()->var()->location() ==
6064 i::VariableLocation::MODULE); 6043 i::VariableLocation::MODULE);
6065 6044
6066 CHECK( 6045 CHECK(
6067 declarations->at(7)->proxy()->raw_name()->IsOneByteEqualTo("*default*")); 6046 declarations->AtForTest(3)->proxy()->raw_name()->IsOneByteEqualTo("foo"));
6068 CHECK(declarations->at(7)->proxy()->var()->mode() == i::CONST); 6047 CHECK(declarations->AtForTest(3)->proxy()->var()->mode() == i::VAR);
6069 CHECK(declarations->at(7)->proxy()->var()->binding_needs_init()); 6048 CHECK(!declarations->AtForTest(3)->proxy()->var()->binding_needs_init());
6070 CHECK(declarations->at(7)->proxy()->var()->location() == 6049 CHECK(declarations->AtForTest(3)->proxy()->var()->location() ==
6071 i::VariableLocation::MODULE); 6050 i::VariableLocation::MODULE);
6072 6051
6073 CHECK( 6052 CHECK(
6074 declarations->at(8)->proxy()->raw_name()->IsOneByteEqualTo("nonexport")); 6053 declarations->AtForTest(4)->proxy()->raw_name()->IsOneByteEqualTo("goo"));
6075 CHECK(declarations->at(8)->proxy()->var()->binding_needs_init()); 6054 CHECK(declarations->AtForTest(4)->proxy()->var()->mode() == i::LET);
6076 CHECK(declarations->at(8)->proxy()->var()->location() != 6055 CHECK(!declarations->AtForTest(4)->proxy()->var()->binding_needs_init());
6056 CHECK(declarations->AtForTest(4)->proxy()->var()->location() ==
6077 i::VariableLocation::MODULE); 6057 i::VariableLocation::MODULE);
6078 6058
6079 CHECK(declarations->at(9)->proxy()->raw_name()->IsOneByteEqualTo("mm")); 6059 CHECK(
6080 CHECK(declarations->at(9)->proxy()->var()->mode() == i::CONST); 6060 declarations->AtForTest(5)->proxy()->raw_name()->IsOneByteEqualTo("hoo"));
6081 CHECK(declarations->at(9)->proxy()->var()->binding_needs_init()); 6061 CHECK(declarations->AtForTest(5)->proxy()->var()->mode() == i::LET);
6082 CHECK(declarations->at(9)->proxy()->var()->location() == 6062 CHECK(declarations->AtForTest(5)->proxy()->var()->binding_needs_init());
6063 CHECK(declarations->AtForTest(5)->proxy()->var()->location() ==
6083 i::VariableLocation::MODULE); 6064 i::VariableLocation::MODULE);
6084 6065
6085 CHECK(declarations->at(10)->proxy()->raw_name()->IsOneByteEqualTo("aa")); 6066 CHECK(
6086 CHECK(declarations->at(10)->proxy()->var()->mode() == i::CONST); 6067 declarations->AtForTest(6)->proxy()->raw_name()->IsOneByteEqualTo("joo"));
6087 CHECK(declarations->at(10)->proxy()->var()->binding_needs_init()); 6068 CHECK(declarations->AtForTest(6)->proxy()->var()->mode() == i::CONST);
6088 CHECK(declarations->at(10)->proxy()->var()->location() == 6069 CHECK(declarations->AtForTest(6)->proxy()->var()->binding_needs_init());
6070 CHECK(declarations->AtForTest(6)->proxy()->var()->location() ==
6089 i::VariableLocation::MODULE); 6071 i::VariableLocation::MODULE);
6090 6072
6091 CHECK(declarations->at(11)->proxy()->raw_name()->IsOneByteEqualTo("loo")); 6073 CHECK(declarations->AtForTest(7)->proxy()->raw_name()->IsOneByteEqualTo(
6092 CHECK(declarations->at(11)->proxy()->var()->mode() == i::CONST); 6074 "*default*"));
6093 CHECK(!declarations->at(11)->proxy()->var()->binding_needs_init()); 6075 CHECK(declarations->AtForTest(7)->proxy()->var()->mode() == i::CONST);
6094 CHECK(declarations->at(11)->proxy()->var()->location() != 6076 CHECK(declarations->AtForTest(7)->proxy()->var()->binding_needs_init());
6077 CHECK(declarations->AtForTest(7)->proxy()->var()->location() ==
6095 i::VariableLocation::MODULE); 6078 i::VariableLocation::MODULE);
6096 6079
6097 CHECK(declarations->at(12)->proxy()->raw_name()->IsOneByteEqualTo("foob")); 6080 CHECK(declarations->AtForTest(8)->proxy()->raw_name()->IsOneByteEqualTo(
6098 CHECK(declarations->at(12)->proxy()->var()->mode() == i::CONST); 6081 "nonexport"));
6099 CHECK(!declarations->at(12)->proxy()->var()->binding_needs_init()); 6082 CHECK(declarations->AtForTest(8)->proxy()->var()->binding_needs_init());
6100 CHECK(declarations->at(12)->proxy()->var()->location() == 6083 CHECK(declarations->AtForTest(8)->proxy()->var()->location() !=
6084 i::VariableLocation::MODULE);
6085
6086 CHECK(
6087 declarations->AtForTest(9)->proxy()->raw_name()->IsOneByteEqualTo("mm"));
6088 CHECK(declarations->AtForTest(9)->proxy()->var()->mode() == i::CONST);
6089 CHECK(declarations->AtForTest(9)->proxy()->var()->binding_needs_init());
6090 CHECK(declarations->AtForTest(9)->proxy()->var()->location() ==
6091 i::VariableLocation::MODULE);
6092
6093 CHECK(
6094 declarations->AtForTest(10)->proxy()->raw_name()->IsOneByteEqualTo("aa"));
6095 CHECK(declarations->AtForTest(10)->proxy()->var()->mode() == i::CONST);
6096 CHECK(declarations->AtForTest(10)->proxy()->var()->binding_needs_init());
6097 CHECK(declarations->AtForTest(10)->proxy()->var()->location() ==
6098 i::VariableLocation::MODULE);
6099
6100 CHECK(declarations->AtForTest(11)->proxy()->raw_name()->IsOneByteEqualTo(
6101 "loo"));
6102 CHECK(declarations->AtForTest(11)->proxy()->var()->mode() == i::CONST);
6103 CHECK(!declarations->AtForTest(11)->proxy()->var()->binding_needs_init());
6104 CHECK(declarations->AtForTest(11)->proxy()->var()->location() !=
6105 i::VariableLocation::MODULE);
6106
6107 CHECK(declarations->AtForTest(12)->proxy()->raw_name()->IsOneByteEqualTo(
6108 "foob"));
6109 CHECK(declarations->AtForTest(12)->proxy()->var()->mode() == i::CONST);
6110 CHECK(!declarations->AtForTest(12)->proxy()->var()->binding_needs_init());
6111 CHECK(declarations->AtForTest(12)->proxy()->var()->location() ==
6101 i::VariableLocation::MODULE); 6112 i::VariableLocation::MODULE);
6102 6113
6103 i::ModuleDescriptor* descriptor = module_scope->module(); 6114 i::ModuleDescriptor* descriptor = module_scope->module();
6104 CHECK_NOT_NULL(descriptor); 6115 CHECK_NOT_NULL(descriptor);
6105 6116
6106 CHECK_EQ(5, descriptor->module_requests().size()); 6117 CHECK_EQ(5, descriptor->module_requests().size());
6107 for (const auto& elem : descriptor->module_requests()) { 6118 for (const auto& elem : descriptor->module_requests()) {
6108 if (elem.first->IsOneByteEqualTo("m.js")) 6119 if (elem.first->IsOneByteEqualTo("m.js"))
6109 CHECK_EQ(elem.second, 0); 6120 CHECK_EQ(elem.second, 0);
6110 else if (elem.first->IsOneByteEqualTo("n.js")) 6121 else if (elem.first->IsOneByteEqualTo("n.js"))
6111 CHECK_EQ(elem.second, 1); 6122 CHECK_EQ(elem.second, 1);
6112 else if (elem.first->IsOneByteEqualTo("p.js")) 6123 else if (elem.first->IsOneByteEqualTo("p.js"))
6113 CHECK_EQ(elem.second, 2); 6124 CHECK_EQ(elem.second, 2);
6114 else if (elem.first->IsOneByteEqualTo("q.js")) 6125 else if (elem.first->IsOneByteEqualTo("q.js"))
6115 CHECK_EQ(elem.second, 3); 6126 CHECK_EQ(elem.second, 3);
6116 else if (elem.first->IsOneByteEqualTo("bar.js")) 6127 else if (elem.first->IsOneByteEqualTo("bar.js"))
6117 CHECK_EQ(elem.second, 4); 6128 CHECK_EQ(elem.second, 4);
6118 else 6129 else
6119 CHECK(false); 6130 CHECK(false);
6120 } 6131 }
6121 6132
6122 CHECK_EQ(3, descriptor->special_exports().length()); 6133 CHECK_EQ(3, descriptor->special_exports().length());
6123 CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0); 6134 CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0);
6124 CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2); 6135 CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2);
6125 CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa", 6136 CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa",
6126 0); // !!! 6137 0); // !!!
6127 6138
6128 CHECK_EQ(8, descriptor->regular_exports().size()); 6139 CHECK_EQ(8, descriptor->regular_exports().size());
6129 entry = descriptor->regular_exports() 6140 entry = descriptor->regular_exports()
6130 .find(declarations->at(3)->proxy()->raw_name()) 6141 .find(declarations->AtForTest(3)->proxy()->raw_name())
6131 ->second; 6142 ->second;
6132 CheckEntry(entry, "foo", "foo", nullptr, -1); 6143 CheckEntry(entry, "foo", "foo", nullptr, -1);
6133 entry = descriptor->regular_exports() 6144 entry = descriptor->regular_exports()
6134 .find(declarations->at(4)->proxy()->raw_name()) 6145 .find(declarations->AtForTest(4)->proxy()->raw_name())
6135 ->second; 6146 ->second;
6136 CheckEntry(entry, "goo", "goo", nullptr, -1); 6147 CheckEntry(entry, "goo", "goo", nullptr, -1);
6137 entry = descriptor->regular_exports() 6148 entry = descriptor->regular_exports()
6138 .find(declarations->at(5)->proxy()->raw_name()) 6149 .find(declarations->AtForTest(5)->proxy()->raw_name())
6139 ->second; 6150 ->second;
6140 CheckEntry(entry, "hoo", "hoo", nullptr, -1); 6151 CheckEntry(entry, "hoo", "hoo", nullptr, -1);
6141 entry = descriptor->regular_exports() 6152 entry = descriptor->regular_exports()
6142 .find(declarations->at(6)->proxy()->raw_name()) 6153 .find(declarations->AtForTest(6)->proxy()->raw_name())
6143 ->second; 6154 ->second;
6144 CheckEntry(entry, "joo", "joo", nullptr, -1); 6155 CheckEntry(entry, "joo", "joo", nullptr, -1);
6145 entry = descriptor->regular_exports() 6156 entry = descriptor->regular_exports()
6146 .find(declarations->at(7)->proxy()->raw_name()) 6157 .find(declarations->AtForTest(7)->proxy()->raw_name())
6147 ->second; 6158 ->second;
6148 CheckEntry(entry, "default", "*default*", nullptr, -1); 6159 CheckEntry(entry, "default", "*default*", nullptr, -1);
6149 entry = descriptor->regular_exports() 6160 entry = descriptor->regular_exports()
6150 .find(declarations->at(12)->proxy()->raw_name()) 6161 .find(declarations->AtForTest(12)->proxy()->raw_name())
6151 ->second; 6162 ->second;
6152 CheckEntry(entry, "foob", "foob", nullptr, -1); 6163 CheckEntry(entry, "foob", "foob", nullptr, -1);
6153 // TODO(neis): The next lines are terrible. Find a better way. 6164 // TODO(neis): The next lines are terrible. Find a better way.
6154 auto name_x = declarations->at(0)->proxy()->raw_name(); 6165 auto name_x = declarations->AtForTest(0)->proxy()->raw_name();
6155 CHECK_EQ(2, descriptor->regular_exports().count(name_x)); 6166 CHECK_EQ(2, descriptor->regular_exports().count(name_x));
6156 auto it = descriptor->regular_exports().equal_range(name_x).first; 6167 auto it = descriptor->regular_exports().equal_range(name_x).first;
6157 entry = it->second; 6168 entry = it->second;
6158 if (entry->export_name->IsOneByteEqualTo("y")) { 6169 if (entry->export_name->IsOneByteEqualTo("y")) {
6159 CheckEntry(entry, "y", "x", nullptr, -1); 6170 CheckEntry(entry, "y", "x", nullptr, -1);
6160 entry = (++it)->second; 6171 entry = (++it)->second;
6161 CheckEntry(entry, "x", "x", nullptr, -1); 6172 CheckEntry(entry, "x", "x", nullptr, -1);
6162 } else { 6173 } else {
6163 CheckEntry(entry, "x", "x", nullptr, -1); 6174 CheckEntry(entry, "x", "x", nullptr, -1);
6164 entry = (++it)->second; 6175 entry = (++it)->second;
6165 CheckEntry(entry, "y", "x", nullptr, -1); 6176 CheckEntry(entry, "y", "x", nullptr, -1);
6166 } 6177 }
6167 6178
6168 CHECK_EQ(2, descriptor->namespace_imports().length()); 6179 CHECK_EQ(2, descriptor->namespace_imports().length());
6169 CheckEntry(descriptor->namespace_imports().at(0), nullptr, "loo", nullptr, 4); 6180 CheckEntry(descriptor->namespace_imports().at(0), nullptr, "loo", nullptr, 4);
6170 CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr, 6181 CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr,
6171 4); 6182 4);
6172 6183
6173 CHECK_EQ(4, descriptor->regular_imports().size()); 6184 CHECK_EQ(4, descriptor->regular_imports().size());
6174 entry = descriptor->regular_imports().find( 6185 entry = descriptor->regular_imports()
6175 declarations->at(1)->proxy()->raw_name())->second; 6186 .find(declarations->AtForTest(1)->proxy()->raw_name())
6187 ->second;
6176 CheckEntry(entry, nullptr, "z", "q", 0); 6188 CheckEntry(entry, nullptr, "z", "q", 0);
6177 entry = descriptor->regular_imports().find( 6189 entry = descriptor->regular_imports()
6178 declarations->at(2)->proxy()->raw_name())->second; 6190 .find(declarations->AtForTest(2)->proxy()->raw_name())
6191 ->second;
6179 CheckEntry(entry, nullptr, "n", "default", 1); 6192 CheckEntry(entry, nullptr, "n", "default", 1);
6180 entry = descriptor->regular_imports().find( 6193 entry = descriptor->regular_imports()
6181 declarations->at(9)->proxy()->raw_name())->second; 6194 .find(declarations->AtForTest(9)->proxy()->raw_name())
6195 ->second;
6182 CheckEntry(entry, nullptr, "mm", "m", 0); 6196 CheckEntry(entry, nullptr, "mm", "m", 0);
6183 entry = descriptor->regular_imports().find( 6197 entry = descriptor->regular_imports()
6184 declarations->at(10)->proxy()->raw_name())->second; 6198 .find(declarations->AtForTest(10)->proxy()->raw_name())
6199 ->second;
6185 CheckEntry(entry, nullptr, "aa", "aa", 0); 6200 CheckEntry(entry, nullptr, "aa", "aa", 0);
6186 } 6201 }
6187 6202
6188 6203
6189 TEST(DuplicateProtoError) { 6204 TEST(DuplicateProtoError) {
6190 const char* context_data[][2] = { 6205 const char* context_data[][2] = {
6191 {"({", "});"}, 6206 {"({", "});"},
6192 {"'use strict'; ({", "});"}, 6207 {"'use strict'; ({", "});"},
6193 {NULL, NULL} 6208 {NULL, NULL}
6194 }; 6209 };
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
8325 const char* data[] = { 8340 const char* data[] = {
8326 "const arguments = 1", 8341 "const arguments = 1",
8327 "let arguments", 8342 "let arguments",
8328 "var arguments", 8343 "var arguments",
8329 NULL 8344 NULL
8330 }; 8345 };
8331 // clang-format on 8346 // clang-format on
8332 RunParserSyncTest(context_data, data, kSuccess); 8347 RunParserSyncTest(context_data, data, kSuccess);
8333 } 8348 }
8334 } 8349 }
OLDNEW
« no previous file with comments | « test/cctest/asmjs/test-asm-typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698