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

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

Issue 2939063002: Strong mode cleaning of many dart2js tests. (Closed)
Patch Set: Use ClassElement. Created 3 years, 6 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 InterfaceType type2 = instance2.type; 617 InterfaceType type2 = instance2.type;
618 return typeEquivalence(type1, type2) && 618 return typeEquivalence(type1, type2) &&
619 instance1.kind == instance2.kind && 619 instance1.kind == instance2.kind &&
620 instance1.isRedirection == instance2.isRedirection; 620 instance1.isRedirection == instance2.isRedirection;
621 } 621 }
622 622
623 bool areAbstractUsagesEquivalent(AbstractUsage usage1, AbstractUsage usage2) { 623 bool areAbstractUsagesEquivalent(AbstractUsage usage1, AbstractUsage usage2) {
624 return usage1.hasSameUsage(usage2); 624 return usage1.hasSameUsage(usage2);
625 } 625 }
626 626
627 bool _areEntitiesEquivalent(a, b) => areElementsEquivalent(a, b);
628
627 void checkResolutionEnqueuers( 629 void checkResolutionEnqueuers(
628 BackendUsage backendUsage1, 630 BackendUsage backendUsage1,
629 BackendUsage backendUsage2, 631 BackendUsage backendUsage2,
630 ResolutionEnqueuer enqueuer1, 632 ResolutionEnqueuer enqueuer1,
631 ResolutionEnqueuer enqueuer2, 633 ResolutionEnqueuer enqueuer2,
632 {bool elementEquivalence(Entity a, Entity b): areElementsEquivalent, 634 {bool elementEquivalence(Entity a, Entity b): _areEntitiesEquivalent,
633 bool typeEquivalence(DartType a, DartType b): areTypesEquivalent, 635 bool typeEquivalence(DartType a, DartType b): areTypesEquivalent,
634 bool elementFilter(Element element), 636 bool elementFilter(Element element),
635 bool verbose: false, 637 bool verbose: false,
636 bool skipClassUsageTesting: false}) { 638 bool skipClassUsageTesting: false}) {
637 elementFilter ??= (_) => true; 639 elementFilter ??= (_) => true;
638 640
639 ResolutionWorldBuilderBase worldBuilder1 = enqueuer1.worldBuilder; 641 ResolutionWorldBuilderBase worldBuilder1 = enqueuer1.worldBuilder;
640 ResolutionWorldBuilderBase worldBuilder2 = enqueuer2.worldBuilder; 642 ResolutionWorldBuilderBase worldBuilder2 = enqueuer2.worldBuilder;
641 643
642 checkSets(worldBuilder1.instantiatedTypes, worldBuilder2.instantiatedTypes, 644 checkSets(worldBuilder1.instantiatedTypes, worldBuilder2.instantiatedTypes,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 "JavaScriptBackend.hasFunctionApplySupport mismatch"); 715 "JavaScriptBackend.hasFunctionApplySupport mismatch");
714 Expect.equals( 716 Expect.equals(
715 backendUsage1.isRuntimeTypeUsed, 717 backendUsage1.isRuntimeTypeUsed,
716 backendUsage2.isRuntimeTypeUsed, 718 backendUsage2.isRuntimeTypeUsed,
717 "JavaScriptBackend.hasRuntimeTypeSupport mismatch"); 719 "JavaScriptBackend.hasRuntimeTypeSupport mismatch");
718 Expect.equals(backendUsage1.isIsolateInUse, backendUsage2.isIsolateInUse, 720 Expect.equals(backendUsage1.isIsolateInUse, backendUsage2.isIsolateInUse,
719 "JavaScriptBackend.hasIsolateSupport mismatch"); 721 "JavaScriptBackend.hasIsolateSupport mismatch");
720 } 722 }
721 723
722 void checkCodegenEnqueuers(CodegenEnqueuer enqueuer1, CodegenEnqueuer enqueuer2, 724 void checkCodegenEnqueuers(CodegenEnqueuer enqueuer1, CodegenEnqueuer enqueuer2,
723 {bool elementEquivalence(Entity a, Entity b): areElementsEquivalent, 725 {bool elementEquivalence(Entity a, Entity b): _areEntitiesEquivalent,
724 bool typeEquivalence(DartType a, DartType b): areTypesEquivalent, 726 bool typeEquivalence(DartType a, DartType b): areTypesEquivalent,
725 bool elementFilter(Element element), 727 bool elementFilter(Element element),
726 bool verbose: false}) { 728 bool verbose: false}) {
727 CodegenWorldBuilderImpl worldBuilder1 = enqueuer1.worldBuilder; 729 CodegenWorldBuilderImpl worldBuilder1 = enqueuer1.worldBuilder;
728 CodegenWorldBuilderImpl worldBuilder2 = enqueuer2.worldBuilder; 730 CodegenWorldBuilderImpl worldBuilder2 = enqueuer2.worldBuilder;
729 731
730 checkSets(worldBuilder1.instantiatedTypes, worldBuilder2.instantiatedTypes, 732 checkSets(worldBuilder1.instantiatedTypes, worldBuilder2.instantiatedTypes,
731 "Instantiated types mismatch", typeEquivalence, 733 "Instantiated types mismatch", typeEquivalence,
732 verbose: verbose); 734 verbose: verbose);
733 735
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 areAbstractUsagesEquivalent, 789 areAbstractUsagesEquivalent,
788 verbose: verbose); 790 verbose: verbose);
789 checkMaps( 791 checkMaps(
790 worldBuilder1.instanceMemberUsageForTesting, 792 worldBuilder1.instanceMemberUsageForTesting,
791 worldBuilder2.instanceMemberUsageForTesting, 793 worldBuilder2.instanceMemberUsageForTesting,
792 'instanceMemberUsageForTesting', 794 'instanceMemberUsageForTesting',
793 elementEquivalence, 795 elementEquivalence,
794 areAbstractUsagesEquivalent, 796 areAbstractUsagesEquivalent,
795 verbose: verbose); 797 verbose: verbose);
796 } 798 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698