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

Side by Side Diff: tests/compiler/dart2js/equivalence/check_functions.dart

Issue 2997033002: Revert "Implement .getCallType" and "Update status" (Closed)
Patch Set: Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Equivalence test functions for data objects. 5 /// Equivalence test functions for data objects.
6 6
7 library dart2js.equivalence.functions; 7 library dart2js.equivalence.functions;
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:compiler/src/common/resolution.dart'; 10 import 'package:compiler/src/common/resolution.dart';
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 Expect.isFalse( 207 Expect.isFalse(
208 child.isInstantiated, 208 child.isInstantiated,
209 'Missing subclass ${child.cls} of ${node1.cls} in ' 209 'Missing subclass ${child.cls} of ${node1.cls} in '
210 '${node2.directSubclasses}'); 210 '${node2.directSubclasses}');
211 } 211 }
212 } 212 }
213 checkMixinUses( 213 checkMixinUses(
214 closedWorld1, closedWorld2, node1.cls, node2.cls, elementEquivalence, 214 closedWorld1, closedWorld2, node1.cls, node2.cls, elementEquivalence,
215 verbose: verbose); 215 verbose: verbose);
216 ClassSet classSet1 = closedWorld1.getClassSet(cls1); 216 Expect.isNotNull(
217 ClassSet classSet2 = closedWorld2.getClassSet(cls2); 217 closedWorld1.getClassSet(cls1), "Missing ClassSet for $cls1");
218 Expect.isNotNull(classSet1, "Missing ClassSet for $cls1"); 218 Expect.isNotNull(
219 Expect.isNotNull(classSet2, "Missing ClassSet for $cls2"); 219 closedWorld2.getClassSet(cls2), "Missing ClassSet for $cls2");
220 checkClassSets(
221 closedWorld1, closedWorld2, classSet1, classSet2, elementEquivalence,
222 verbose: verbose, allowMissingClosureClasses: allowMissingClosureClasses);
223 }
224
225 void checkClassSets(
226 ClosedWorld closedWorld1,
227 ClosedWorld closedWorld2,
228 ClassSet classSet1,
229 ClassSet classSet2,
230 bool elementEquivalence(Entity a, Entity b),
231 {bool verbose: false,
232 bool allowMissingClosureClasses: false}) {
233 for (ClassHierarchyNode child in classSet1.subtypeNodes) {
234 bool found = false;
235 for (ClassHierarchyNode other in classSet2.subtypeNodes) {
236 ClassEntity child1 = child.cls;
237 ClassEntity child2 = other.cls;
238 if (elementEquivalence(child1, child2)) {
239 found = true;
240 break;
241 }
242 }
243 if (!found && (!child.cls.isClosure || !allowMissingClosureClasses)) {
244 if (child.isInstantiated) {
245 print('Missing subtype ${child.cls} of ${classSet1.cls} '
246 'in ${classSet2.subtypeNodes}');
247 print(closedWorld1.dump(
248 verbose ? closedWorld1.commonElements.objectClass : classSet1.cls));
249 print(closedWorld2.dump(
250 verbose ? closedWorld2.commonElements.objectClass : classSet2.cls));
251 }
252 Expect.isFalse(
253 child.isInstantiated,
254 'Missing subclass ${child.cls} of ${classSet1.cls} in '
255 '${classSet2.subtypeNodes}');
256 }
257 }
258 } 220 }
259 221
260 void checkMixinUses( 222 void checkMixinUses(
261 ClosedWorld closedWorld1, 223 ClosedWorld closedWorld1,
262 ClosedWorld closedWorld2, 224 ClosedWorld closedWorld2,
263 ClassEntity class1, 225 ClassEntity class1,
264 ClassEntity class2, 226 ClassEntity class2,
265 bool elementEquivalence(Entity a, Entity b), 227 bool elementEquivalence(Entity a, Entity b),
266 {bool verbose: false}) { 228 {bool verbose: false}) {
267 checkSets(closedWorld1.mixinUsesOf(class1), closedWorld2.mixinUsesOf(class2), 229 checkSets(closedWorld1.mixinUsesOf(class1), closedWorld2.mixinUsesOf(class2),
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 check(usage1, usage2, 'isRuntimeTypeUsed', usage1.isRuntimeTypeUsed, 447 check(usage1, usage2, 'isRuntimeTypeUsed', usage1.isRuntimeTypeUsed,
486 usage2.isRuntimeTypeUsed); 448 usage2.isRuntimeTypeUsed);
487 check(usage1, usage2, 'isIsolateInUse', usage1.isIsolateInUse, 449 check(usage1, usage2, 'isIsolateInUse', usage1.isIsolateInUse,
488 usage2.isIsolateInUse); 450 usage2.isIsolateInUse);
489 check(usage1, usage2, 'isFunctionApplyUsed', usage1.isFunctionApplyUsed, 451 check(usage1, usage2, 'isFunctionApplyUsed', usage1.isFunctionApplyUsed,
490 usage2.isFunctionApplyUsed); 452 usage2.isFunctionApplyUsed);
491 check(usage1, usage2, 'isNoSuchMethodUsed', usage1.isNoSuchMethodUsed, 453 check(usage1, usage2, 'isNoSuchMethodUsed', usage1.isNoSuchMethodUsed,
492 usage2.isNoSuchMethodUsed); 454 usage2.isNoSuchMethodUsed);
493 } 455 }
494 456
495 checkElementEnvironment(ElementEnvironment env1, ElementEnvironment env2, 457 checkElementEnvironment(
496 DartTypes types1, DartTypes types2, TestStrategy strategy, 458 ElementEnvironment env1, ElementEnvironment env2, TestStrategy strategy,
497 {bool checkConstructorBodies: false}) { 459 {bool checkConstructorBodies: false}) {
498 strategy.testElements( 460 strategy.testElements(
499 env1, env2, 'mainLibrary', env1.mainLibrary, env2.mainLibrary); 461 env1, env2, 'mainLibrary', env1.mainLibrary, env2.mainLibrary);
500 strategy.testElements( 462 strategy.testElements(
501 env1, env2, 'mainFunction', env1.mainFunction, env2.mainFunction); 463 env1, env2, 'mainFunction', env1.mainFunction, env2.mainFunction);
502 464
503 checkMembers(MemberEntity member1, MemberEntity member2) { 465 checkMembers(MemberEntity member1, MemberEntity member2) {
504 Expect.equals(env1.isDeferredLoadLibraryGetter(member1), 466 Expect.equals(env1.isDeferredLoadLibraryGetter(member1),
505 env2.isDeferredLoadLibraryGetter(member2)); 467 env2.isDeferredLoadLibraryGetter(member2));
506 468
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 check( 544 check(
583 cls1, 545 cls1,
584 cls2, 546 cls2,
585 'getEffectiveMixinClass', 547 'getEffectiveMixinClass',
586 env1.getEffectiveMixinClass(cls1), 548 env1.getEffectiveMixinClass(cls1),
587 env2.getEffectiveMixinClass(cls2), 549 env2.getEffectiveMixinClass(cls2),
588 strategy.elementEquivalence); 550 strategy.elementEquivalence);
589 551
590 // TODO(johnniwinther): Check type variable bounds. 552 // TODO(johnniwinther): Check type variable bounds.
591 553
592 check(cls1, cls2, 'callType', types1.getCallType(thisType1),
593 types2.getCallType(thisType2), strategy.typeEquivalence);
594
595 List<InterfaceType> supertypes1 = <InterfaceType>[]; 554 List<InterfaceType> supertypes1 = <InterfaceType>[];
596 env1.forEachSupertype(cls1, supertypes1.add); 555 env1.forEachSupertype(cls1, supertypes1.add);
597 List<InterfaceType> supertypes2 = <InterfaceType>[]; 556 List<InterfaceType> supertypes2 = <InterfaceType>[];
598 env2.forEachSupertype(cls2, supertypes2.add); 557 env2.forEachSupertype(cls2, supertypes2.add);
599 checkLists(supertypes1, supertypes2, 'supertypes on $cls1, $cls2', 558 checkLists(supertypes1, supertypes2, 'supertypes on $cls1, $cls2',
600 strategy.typeEquivalence); 559 strategy.typeEquivalence);
601 560
602 List<ClassEntity> mixins1 = <ClassEntity>[]; 561 List<ClassEntity> mixins1 = <ClassEntity>[];
603 env1.forEachMixin(cls1, mixins1.add); 562 env1.forEachMixin(cls1, mixins1.add);
604 List<ClassEntity> mixins2 = <ClassEntity>[]; 563 List<ClassEntity> mixins2 = <ClassEntity>[];
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 print(' ${js.nodeToString(node1)}'); 1179 print(' ${js.nodeToString(node1)}');
1221 print(' ${js.nodeToString(node2)}'); 1180 print(' ${js.nodeToString(node2)}');
1222 } 1181 }
1223 return expectedValue == label2; 1182 return expectedValue == label2;
1224 } else { 1183 } else {
1225 labelsMap[label1] = label2; 1184 labelsMap[label1] = label2;
1226 return true; 1185 return true;
1227 } 1186 }
1228 } 1187 }
1229 } 1188 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/types.dart ('k') | tests/compiler/dart2js/kernel/closed_world2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698