| 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'; |
| 11 import '../constants/expressions.dart'; | 11 import '../constants/expressions.dart'; |
| 12 import '../constants/values.dart'; | 12 import '../constants/values.dart'; |
| 13 import '../elements/resolution_types.dart'; | 13 import '../elements/resolution_types.dart'; |
| 14 import '../elements/elements.dart'; | 14 import '../elements/elements.dart'; |
| 15 import '../elements/entities.dart'; | 15 import '../elements/entities.dart'; |
| 16 import '../elements/modelx.dart'; |
| 16 import '../elements/jumps.dart'; | 17 import '../elements/jumps.dart'; |
| 17 import '../elements/names.dart'; | 18 import '../elements/names.dart'; |
| 18 import '../elements/types.dart'; | 19 import '../elements/types.dart'; |
| 19 import '../elements/visitor.dart'; | 20 import '../elements/visitor.dart'; |
| 20 import '../js_backend/backend_serialization.dart' | 21 import '../js_backend/backend_serialization.dart' |
| 21 show NativeBehaviorSerialization; | 22 show NativeBehaviorSerialization; |
| 22 import '../native/native.dart' show NativeBehavior; | 23 import '../native/native.dart' show NativeBehavior; |
| 23 import '../resolution/access_semantics.dart'; | 24 import '../resolution/access_semantics.dart'; |
| 24 import '../resolution/send_structure.dart'; | 25 import '../resolution/send_structure.dart'; |
| 25 import '../resolution/tree_elements.dart'; | 26 import '../resolution/tree_elements.dart'; |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) && | 1237 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) && |
| 1237 strategy.test( | 1238 strategy.test( |
| 1238 a, b, 'isContinueTarget', a.isContinueTarget, b.isContinueTarget) && | 1239 a, b, 'isContinueTarget', a.isContinueTarget, b.isContinueTarget) && |
| 1239 strategy.testLists(a, b, 'labels', a.labels.toList(), b.labels.toList(), | 1240 strategy.testLists(a, b, 'labels', a.labels.toList(), b.labels.toList(), |
| 1240 (a, b) { | 1241 (a, b) { |
| 1241 return indices1.nodeIndices[a.label] == indices2.nodeIndices[b.label]; | 1242 return indices1.nodeIndices[a.label] == indices2.nodeIndices[b.label]; |
| 1242 }); | 1243 }); |
| 1243 } | 1244 } |
| 1244 | 1245 |
| 1245 bool testLabelDefinitions(Node node1, Node node2, String property, | 1246 bool testLabelDefinitions(Node node1, Node node2, String property, |
| 1246 LabelDefinition a, LabelDefinition b) { | 1247 LabelDefinitionX a, LabelDefinitionX b) { |
| 1247 if (identical(a, b)) return true; | 1248 if (identical(a, b)) return true; |
| 1248 if (a == null || b == null) return false; | 1249 if (a == null || b == null) return false; |
| 1249 return strategy.test(a, b, 'label', indices1.nodeIndices[a.label], | 1250 return strategy.test(a, b, 'label', indices1.nodeIndices[a.label], |
| 1250 indices2.nodeIndices[b.label]) && | 1251 indices2.nodeIndices[b.label]) && |
| 1251 strategy.test(a, b, 'labelName', a.labelName, b.labelName) && | 1252 strategy.test(a, b, 'labelName', a.labelName, b.labelName) && |
| 1252 strategy.test(a, b, 'target', indices1.nodeIndices[a.target.statement], | 1253 strategy.test(a, b, 'target', indices1.nodeIndices[a.target.statement], |
| 1253 indices2.nodeIndices[b.target.statement]) && | 1254 indices2.nodeIndices[b.target.statement]) && |
| 1254 strategy.test( | 1255 strategy.test( |
| 1255 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) && | 1256 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) && |
| 1256 strategy.test( | 1257 strategy.test( |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 } | 2176 } |
| 2176 | 2177 |
| 2177 bool areMetadataAnnotationsEquivalent( | 2178 bool areMetadataAnnotationsEquivalent( |
| 2178 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 2179 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
| 2179 if (metadata1 == metadata2) return true; | 2180 if (metadata1 == metadata2) return true; |
| 2180 if (metadata1 == null || metadata2 == null) return false; | 2181 if (metadata1 == null || metadata2 == null) return false; |
| 2181 return areElementsEquivalent( | 2182 return areElementsEquivalent( |
| 2182 metadata1.annotatedElement, metadata2.annotatedElement) && | 2183 metadata1.annotatedElement, metadata2.annotatedElement) && |
| 2183 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 2184 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
| 2184 } | 2185 } |
| OLD | NEW |