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

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

Issue 2481013010: [parser, serializer] Fix more -Wsign-compare warnings. (Closed)
Patch Set: 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 | « src/value-serializer.cc ('k') | test/cctest/test-serialize.cc » ('j') | 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 6102 matching lines...) Expand 10 before | Expand all | Expand 10 after
6113 CHECK(declarations->AtForTest(12)->proxy()->raw_name()->IsOneByteEqualTo( 6113 CHECK(declarations->AtForTest(12)->proxy()->raw_name()->IsOneByteEqualTo(
6114 "foob")); 6114 "foob"));
6115 CHECK(declarations->AtForTest(12)->proxy()->var()->mode() == i::CONST); 6115 CHECK(declarations->AtForTest(12)->proxy()->var()->mode() == i::CONST);
6116 CHECK(!declarations->AtForTest(12)->proxy()->var()->binding_needs_init()); 6116 CHECK(!declarations->AtForTest(12)->proxy()->var()->binding_needs_init());
6117 CHECK(declarations->AtForTest(12)->proxy()->var()->location() == 6117 CHECK(declarations->AtForTest(12)->proxy()->var()->location() ==
6118 i::VariableLocation::MODULE); 6118 i::VariableLocation::MODULE);
6119 6119
6120 i::ModuleDescriptor* descriptor = module_scope->module(); 6120 i::ModuleDescriptor* descriptor = module_scope->module();
6121 CHECK_NOT_NULL(descriptor); 6121 CHECK_NOT_NULL(descriptor);
6122 6122
6123 CHECK_EQ(5, descriptor->module_requests().size()); 6123 CHECK_EQ(5u, descriptor->module_requests().size());
6124 for (const auto& elem : descriptor->module_requests()) { 6124 for (const auto& elem : descriptor->module_requests()) {
6125 if (elem.first->IsOneByteEqualTo("m.js")) 6125 if (elem.first->IsOneByteEqualTo("m.js"))
6126 CHECK_EQ(elem.second, 0); 6126 CHECK_EQ(elem.second, 0);
6127 else if (elem.first->IsOneByteEqualTo("n.js")) 6127 else if (elem.first->IsOneByteEqualTo("n.js"))
6128 CHECK_EQ(elem.second, 1); 6128 CHECK_EQ(elem.second, 1);
6129 else if (elem.first->IsOneByteEqualTo("p.js")) 6129 else if (elem.first->IsOneByteEqualTo("p.js"))
6130 CHECK_EQ(elem.second, 2); 6130 CHECK_EQ(elem.second, 2);
6131 else if (elem.first->IsOneByteEqualTo("q.js")) 6131 else if (elem.first->IsOneByteEqualTo("q.js"))
6132 CHECK_EQ(elem.second, 3); 6132 CHECK_EQ(elem.second, 3);
6133 else if (elem.first->IsOneByteEqualTo("bar.js")) 6133 else if (elem.first->IsOneByteEqualTo("bar.js"))
6134 CHECK_EQ(elem.second, 4); 6134 CHECK_EQ(elem.second, 4);
6135 else 6135 else
6136 CHECK(false); 6136 CHECK(false);
6137 } 6137 }
6138 6138
6139 CHECK_EQ(3, descriptor->special_exports().length()); 6139 CHECK_EQ(3, descriptor->special_exports().length());
6140 CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0); 6140 CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0);
6141 CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2); 6141 CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2);
6142 CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa", 6142 CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa",
6143 0); // !!! 6143 0); // !!!
6144 6144
6145 CHECK_EQ(8, descriptor->regular_exports().size()); 6145 CHECK_EQ(8u, descriptor->regular_exports().size());
6146 entry = descriptor->regular_exports() 6146 entry = descriptor->regular_exports()
6147 .find(declarations->AtForTest(3)->proxy()->raw_name()) 6147 .find(declarations->AtForTest(3)->proxy()->raw_name())
6148 ->second; 6148 ->second;
6149 CheckEntry(entry, "foo", "foo", nullptr, -1); 6149 CheckEntry(entry, "foo", "foo", nullptr, -1);
6150 entry = descriptor->regular_exports() 6150 entry = descriptor->regular_exports()
6151 .find(declarations->AtForTest(4)->proxy()->raw_name()) 6151 .find(declarations->AtForTest(4)->proxy()->raw_name())
6152 ->second; 6152 ->second;
6153 CheckEntry(entry, "goo", "goo", nullptr, -1); 6153 CheckEntry(entry, "goo", "goo", nullptr, -1);
6154 entry = descriptor->regular_exports() 6154 entry = descriptor->regular_exports()
6155 .find(declarations->AtForTest(5)->proxy()->raw_name()) 6155 .find(declarations->AtForTest(5)->proxy()->raw_name())
6156 ->second; 6156 ->second;
6157 CheckEntry(entry, "hoo", "hoo", nullptr, -1); 6157 CheckEntry(entry, "hoo", "hoo", nullptr, -1);
6158 entry = descriptor->regular_exports() 6158 entry = descriptor->regular_exports()
6159 .find(declarations->AtForTest(6)->proxy()->raw_name()) 6159 .find(declarations->AtForTest(6)->proxy()->raw_name())
6160 ->second; 6160 ->second;
6161 CheckEntry(entry, "joo", "joo", nullptr, -1); 6161 CheckEntry(entry, "joo", "joo", nullptr, -1);
6162 entry = descriptor->regular_exports() 6162 entry = descriptor->regular_exports()
6163 .find(declarations->AtForTest(7)->proxy()->raw_name()) 6163 .find(declarations->AtForTest(7)->proxy()->raw_name())
6164 ->second; 6164 ->second;
6165 CheckEntry(entry, "default", "*default*", nullptr, -1); 6165 CheckEntry(entry, "default", "*default*", nullptr, -1);
6166 entry = descriptor->regular_exports() 6166 entry = descriptor->regular_exports()
6167 .find(declarations->AtForTest(12)->proxy()->raw_name()) 6167 .find(declarations->AtForTest(12)->proxy()->raw_name())
6168 ->second; 6168 ->second;
6169 CheckEntry(entry, "foob", "foob", nullptr, -1); 6169 CheckEntry(entry, "foob", "foob", nullptr, -1);
6170 // TODO(neis): The next lines are terrible. Find a better way. 6170 // TODO(neis): The next lines are terrible. Find a better way.
6171 auto name_x = declarations->AtForTest(0)->proxy()->raw_name(); 6171 auto name_x = declarations->AtForTest(0)->proxy()->raw_name();
6172 CHECK_EQ(2, descriptor->regular_exports().count(name_x)); 6172 CHECK_EQ(2u, descriptor->regular_exports().count(name_x));
6173 auto it = descriptor->regular_exports().equal_range(name_x).first; 6173 auto it = descriptor->regular_exports().equal_range(name_x).first;
6174 entry = it->second; 6174 entry = it->second;
6175 if (entry->export_name->IsOneByteEqualTo("y")) { 6175 if (entry->export_name->IsOneByteEqualTo("y")) {
6176 CheckEntry(entry, "y", "x", nullptr, -1); 6176 CheckEntry(entry, "y", "x", nullptr, -1);
6177 entry = (++it)->second; 6177 entry = (++it)->second;
6178 CheckEntry(entry, "x", "x", nullptr, -1); 6178 CheckEntry(entry, "x", "x", nullptr, -1);
6179 } else { 6179 } else {
6180 CheckEntry(entry, "x", "x", nullptr, -1); 6180 CheckEntry(entry, "x", "x", nullptr, -1);
6181 entry = (++it)->second; 6181 entry = (++it)->second;
6182 CheckEntry(entry, "y", "x", nullptr, -1); 6182 CheckEntry(entry, "y", "x", nullptr, -1);
6183 } 6183 }
6184 6184
6185 CHECK_EQ(2, descriptor->namespace_imports().length()); 6185 CHECK_EQ(2, descriptor->namespace_imports().length());
6186 CheckEntry(descriptor->namespace_imports().at(0), nullptr, "loo", nullptr, 4); 6186 CheckEntry(descriptor->namespace_imports().at(0), nullptr, "loo", nullptr, 4);
6187 CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr, 6187 CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr,
6188 4); 6188 4);
6189 6189
6190 CHECK_EQ(4, descriptor->regular_imports().size()); 6190 CHECK_EQ(4u, descriptor->regular_imports().size());
6191 entry = descriptor->regular_imports() 6191 entry = descriptor->regular_imports()
6192 .find(declarations->AtForTest(1)->proxy()->raw_name()) 6192 .find(declarations->AtForTest(1)->proxy()->raw_name())
6193 ->second; 6193 ->second;
6194 CheckEntry(entry, nullptr, "z", "q", 0); 6194 CheckEntry(entry, nullptr, "z", "q", 0);
6195 entry = descriptor->regular_imports() 6195 entry = descriptor->regular_imports()
6196 .find(declarations->AtForTest(2)->proxy()->raw_name()) 6196 .find(declarations->AtForTest(2)->proxy()->raw_name())
6197 ->second; 6197 ->second;
6198 CheckEntry(entry, nullptr, "n", "default", 1); 6198 CheckEntry(entry, nullptr, "n", "default", 1);
6199 entry = descriptor->regular_imports() 6199 entry = descriptor->regular_imports()
6200 .find(declarations->AtForTest(9)->proxy()->raw_name()) 6200 .find(declarations->AtForTest(9)->proxy()->raw_name())
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
8323 const char* data[] = { 8323 const char* data[] = {
8324 "const arguments = 1", 8324 "const arguments = 1",
8325 "let arguments", 8325 "let arguments",
8326 "var arguments", 8326 "var arguments",
8327 NULL 8327 NULL
8328 }; 8328 };
8329 // clang-format on 8329 // clang-format on
8330 RunParserSyncTest(context_data, data, kSuccess); 8330 RunParserSyncTest(context_data, data, kSuccess);
8331 } 8331 }
8332 } 8332 }
OLDNEW
« no previous file with comments | « src/value-serializer.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698