OLD | NEW |
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.dart'; | 10 import '../common.dart'; |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 element1, element2, 'name', element1.name, element2.name) && | 516 element1, element2, 'name', element1.name, element2.name) && |
517 visit(element1.library, element2.library); | 517 visit(element1.library, element2.library); |
518 } | 518 } |
519 | 519 |
520 @override | 520 @override |
521 bool visitErroneousElement( | 521 bool visitErroneousElement( |
522 ErroneousElement element1, ErroneousElement element2) { | 522 ErroneousElement element1, ErroneousElement element2) { |
523 return strategy.test(element1, element2, 'messageKind', | 523 return strategy.test(element1, element2, 'messageKind', |
524 element1.messageKind, element2.messageKind); | 524 element1.messageKind, element2.messageKind); |
525 } | 525 } |
| 526 |
| 527 @override |
| 528 bool visitWarnOnUseElement( |
| 529 WarnOnUseElement element1, WarnOnUseElement element2) { |
| 530 return strategy.testElements(element1, element2, 'wrappedElement', |
| 531 element1.wrappedElement, element2.wrappedElement); |
| 532 } |
526 } | 533 } |
527 | 534 |
528 /// Visitor that checks for equivalence of [DartType]s. | 535 /// Visitor that checks for equivalence of [DartType]s. |
529 class TypeEquivalence implements DartTypeVisitor<bool, DartType> { | 536 class TypeEquivalence implements DartTypeVisitor<bool, DartType> { |
530 final TestStrategy strategy; | 537 final TestStrategy strategy; |
531 | 538 |
532 const TypeEquivalence([this.strategy = const TestStrategy()]); | 539 const TypeEquivalence([this.strategy = const TestStrategy()]); |
533 | 540 |
534 bool visit(DartType type1, DartType type2) { | 541 bool visit(DartType type1, DartType type2) { |
535 return strategy.test(type1, type2, 'kind', type1.kind, type2.kind) && | 542 return strategy.test(type1, type2, 'kind', type1.kind, type2.kind) && |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 } | 1850 } |
1844 | 1851 |
1845 bool areMetadataAnnotationsEquivalent( | 1852 bool areMetadataAnnotationsEquivalent( |
1846 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 1853 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
1847 if (metadata1 == metadata2) return true; | 1854 if (metadata1 == metadata2) return true; |
1848 if (metadata1 == null || metadata2 == null) return false; | 1855 if (metadata1 == null || metadata2 == null) return false; |
1849 return areElementsEquivalent( | 1856 return areElementsEquivalent( |
1850 metadata1.annotatedElement, metadata2.annotatedElement) && | 1857 metadata1.annotatedElement, metadata2.annotatedElement) && |
1851 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 1858 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
1852 } | 1859 } |
OLD | NEW |