| 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/resolution.dart'; | 10 import '../common/resolution.dart'; |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 509 |
| 510 @override | 510 @override |
| 511 bool visitSetterElement(SetterElement element1, SetterElement element2) { | 511 bool visitSetterElement(SetterElement element1, SetterElement element2) { |
| 512 return checkMembers(element1, element2); | 512 return checkMembers(element1, element2); |
| 513 } | 513 } |
| 514 | 514 |
| 515 @override | 515 @override |
| 516 bool visitLocalFunctionElement( | 516 bool visitLocalFunctionElement( |
| 517 LocalFunctionElement element1, LocalFunctionElement element2) { | 517 LocalFunctionElement element1, LocalFunctionElement element2) { |
| 518 // TODO(johnniwinther): Define an equivalence on locals. | 518 // TODO(johnniwinther): Define an equivalence on locals. |
| 519 return checkMembers(element1.memberContext, element2.memberContext); | 519 return strategy.test( |
| 520 element1, element2, 'name', element1.name, element2.name) && |
| 521 checkMembers(element1.memberContext, element2.memberContext); |
| 520 } | 522 } |
| 521 | 523 |
| 522 @override | 524 @override |
| 523 bool visitLocalVariableElement( | 525 bool visitLocalVariableElement( |
| 524 LocalVariableElement element1, LocalVariableElement element2) { | 526 LocalVariableElement element1, LocalVariableElement element2) { |
| 525 // TODO(johnniwinther): Define an equivalence on locals. | 527 // TODO(johnniwinther): Define an equivalence on locals. |
| 526 return checkMembers(element1.memberContext, element2.memberContext); | 528 return strategy.test( |
| 529 element1, element2, 'name', element1.name, element2.name) && |
| 530 checkMembers(element1.memberContext, element2.memberContext); |
| 527 } | 531 } |
| 528 | 532 |
| 529 bool visitAbstractFieldElement( | 533 bool visitAbstractFieldElement( |
| 530 AbstractFieldElement element1, AbstractFieldElement element2) { | 534 AbstractFieldElement element1, AbstractFieldElement element2) { |
| 531 return checkMembers(element1, element2); | 535 return checkMembers(element1, element2); |
| 532 } | 536 } |
| 533 | 537 |
| 534 @override | 538 @override |
| 535 bool visitTypeVariableElement( | 539 bool visitTypeVariableElement( |
| 536 TypeVariableElement element1, TypeVariableElement element2) { | 540 TypeVariableElement element1, TypeVariableElement element2) { |
| (...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 } | 2031 } |
| 2028 | 2032 |
| 2029 bool areMetadataAnnotationsEquivalent( | 2033 bool areMetadataAnnotationsEquivalent( |
| 2030 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 2034 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
| 2031 if (metadata1 == metadata2) return true; | 2035 if (metadata1 == metadata2) return true; |
| 2032 if (metadata1 == null || metadata2 == null) return false; | 2036 if (metadata1 == null || metadata2 == null) return false; |
| 2033 return areElementsEquivalent( | 2037 return areElementsEquivalent( |
| 2034 metadata1.annotatedElement, metadata2.annotatedElement) && | 2038 metadata1.annotatedElement, metadata2.annotatedElement) && |
| 2035 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 2039 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
| 2036 } | 2040 } |
| OLD | NEW |