| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 bool areSelectorsEquivalent(Selector a, Selector b) { | 144 bool areSelectorsEquivalent(Selector a, Selector b) { |
| 145 if (identical(a, b)) return true; | 145 if (identical(a, b)) return true; |
| 146 if (a == null || b == null) return false; | 146 if (a == null || b == null) return false; |
| 147 return a.kind == b.kind && | 147 return a.kind == b.kind && |
| 148 a.callStructure == b.callStructure && | 148 a.callStructure == b.callStructure && |
| 149 areNamesEquivalent(a.memberName, b.memberName); | 149 areNamesEquivalent(a.memberName, b.memberName); |
| 150 } | 150 } |
| 151 | 151 |
| 152 /// Returns `true` if the names [a] and [b] are equivalent. | 152 /// Returns `true` if the names [a] and [b] are equivalent. |
| 153 bool areNamesEquivalent(Name a, Name b) { | 153 bool areNamesEquivalent(Name a, Name b) { |
| 154 LibraryElement library1 = a.library; |
| 155 LibraryElement library2 = b.library; |
| 154 return a.text == b.text && | 156 return a.text == b.text && |
| 155 a.isSetter == b.isSetter && | 157 a.isSetter == b.isSetter && |
| 156 areElementsEquivalent(a.library, b.library); | 158 areElementsEquivalent(library1, library2); |
| 157 } | 159 } |
| 158 | 160 |
| 159 /// Returns `true` if the dynamic uses [a] and [b] are equivalent. | 161 /// Returns `true` if the dynamic uses [a] and [b] are equivalent. |
| 160 bool areDynamicUsesEquivalent(DynamicUse a, DynamicUse b) { | 162 bool areDynamicUsesEquivalent(DynamicUse a, DynamicUse b) { |
| 161 return areSelectorsEquivalent(a.selector, b.selector); | 163 return areSelectorsEquivalent(a.selector, b.selector); |
| 162 } | 164 } |
| 163 | 165 |
| 164 /// Returns `true` if the static uses [a] and [b] are equivalent. | 166 /// Returns `true` if the static uses [a] and [b] are equivalent. |
| 165 bool areStaticUsesEquivalent(StaticUse a, StaticUse b) { | 167 bool areStaticUsesEquivalent(StaticUse a, StaticUse b) { |
| 166 return a.kind == b.kind && areElementsEquivalent(a.element, b.element); | 168 return a.kind == b.kind && areElementsEquivalent(a.element, b.element); |
| (...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 } | 2045 } |
| 2044 | 2046 |
| 2045 bool areMetadataAnnotationsEquivalent( | 2047 bool areMetadataAnnotationsEquivalent( |
| 2046 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 2048 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
| 2047 if (metadata1 == metadata2) return true; | 2049 if (metadata1 == metadata2) return true; |
| 2048 if (metadata1 == null || metadata2 == null) return false; | 2050 if (metadata1 == null || metadata2 == null) return false; |
| 2049 return areElementsEquivalent( | 2051 return areElementsEquivalent( |
| 2050 metadata1.annotatedElement, metadata2.annotatedElement) && | 2052 metadata1.annotatedElement, metadata2.annotatedElement) && |
| 2051 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 2053 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
| 2052 } | 2054 } |
| OLD | NEW |