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

Side by Side Diff: pkg/compiler/lib/src/serialization/equivalence.dart

Issue 2829683007: Extract DartTypeVisitor and subclasses from resolution_types. (Closed)
Patch Set: Created 3 years, 8 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /// Functions for asserting equivalence across serialization. 5 /// Functions for asserting equivalence across serialization.
6 6
7 library dart2js.serialization.equivalence; 7 library dart2js.serialization.equivalence;
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common/resolution.dart'; 10 import '../common/resolution.dart';
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 627
628 @override 628 @override
629 bool visitWarnOnUseElement( 629 bool visitWarnOnUseElement(
630 WarnOnUseElement element1, WarnOnUseElement element2) { 630 WarnOnUseElement element1, WarnOnUseElement element2) {
631 return strategy.testElements(element1, element2, 'wrappedElement', 631 return strategy.testElements(element1, element2, 'wrappedElement',
632 element1.wrappedElement, element2.wrappedElement); 632 element1.wrappedElement, element2.wrappedElement);
633 } 633 }
634 } 634 }
635 635
636 /// Visitor that checks for equivalence of [ResolutionDartType]s. 636 /// Visitor that checks for equivalence of [ResolutionDartType]s.
637 class TypeEquivalence implements DartTypeVisitor<bool, ResolutionDartType> { 637 class TypeEquivalence
638 implements ResolutionDartTypeVisitor<bool, ResolutionDartType> {
638 final TestStrategy strategy; 639 final TestStrategy strategy;
639 640
640 const TypeEquivalence([this.strategy = const TestStrategy()]); 641 const TypeEquivalence([this.strategy = const TestStrategy()]);
641 642
642 bool visit(ResolutionDartType type1, ResolutionDartType type2) { 643 bool visit(ResolutionDartType type1, ResolutionDartType type2) {
643 return strategy.test(type1, type2, 'kind', type1.kind, type2.kind) && 644 return strategy.test(type1, type2, 'kind', type1.kind, type2.kind) &&
644 type1.accept(this, type2); 645 type1.accept(this, type2);
645 } 646 }
646 647
647 @override 648 @override
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 } 2143 }
2143 2144
2144 bool areMetadataAnnotationsEquivalent( 2145 bool areMetadataAnnotationsEquivalent(
2145 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { 2146 MetadataAnnotation metadata1, MetadataAnnotation metadata2) {
2146 if (metadata1 == metadata2) return true; 2147 if (metadata1 == metadata2) return true;
2147 if (metadata1 == null || metadata2 == null) return false; 2148 if (metadata1 == null || metadata2 == null) return false;
2148 return areElementsEquivalent( 2149 return areElementsEquivalent(
2149 metadata1.annotatedElement, metadata2.annotatedElement) && 2150 metadata1.annotatedElement, metadata2.annotatedElement) &&
2150 areConstantsEquivalent(metadata1.constant, metadata2.constant); 2151 areConstantsEquivalent(metadata1.constant, metadata2.constant);
2151 } 2152 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/typedefs.dart ('k') | pkg/compiler/lib/src/serialization/type_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698