| 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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 impact2.dynamicUses, areDynamicUsesEquivalent) && | 983 impact2.dynamicUses, areDynamicUsesEquivalent) && |
| 984 strategy.testSets( | 984 strategy.testSets( |
| 985 impact1, impact2, 'features', impact1.features, impact2.features) && | 985 impact1, impact2, 'features', impact1.features, impact2.features) && |
| 986 strategy.testSets(impact1, impact2, 'listLiterals', impact1.listLiterals, | 986 strategy.testSets(impact1, impact2, 'listLiterals', impact1.listLiterals, |
| 987 impact2.listLiterals, areListLiteralUsesEquivalent) && | 987 impact2.listLiterals, areListLiteralUsesEquivalent) && |
| 988 strategy.testSets(impact1, impact2, 'mapLiterals', impact1.mapLiterals, | 988 strategy.testSets(impact1, impact2, 'mapLiterals', impact1.mapLiterals, |
| 989 impact2.mapLiterals, areMapLiteralUsesEquivalent) && | 989 impact2.mapLiterals, areMapLiteralUsesEquivalent) && |
| 990 strategy.testSets(impact1, impact2, 'staticUses', impact1.staticUses, | 990 strategy.testSets(impact1, impact2, 'staticUses', impact1.staticUses, |
| 991 impact2.staticUses, areStaticUsesEquivalent) && | 991 impact2.staticUses, areStaticUsesEquivalent) && |
| 992 strategy.testSets(impact1, impact2, 'typeUses', impact1.typeUses, | 992 strategy.testSets(impact1, impact2, 'typeUses', impact1.typeUses, |
| 993 impact2.typeUses, areTypeUsesEquivalent) && | 993 impact2.typeUses, areTypeUsesEquivalent); |
| 994 strategy.testSets(impact1, impact2, 'nativeData', impact1.nativeData, | |
| 995 impact2.nativeData, testNativeBehavior); | |
| 996 } | 994 } |
| 997 | 995 |
| 998 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy]. | 996 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy]. |
| 999 bool testResolvedAstEquivalence( | 997 bool testResolvedAstEquivalence( |
| 1000 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, | 998 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, |
| 1001 [TestStrategy strategy = const TestStrategy()]) { | 999 [TestStrategy strategy = const TestStrategy()]) { |
| 1002 if (!strategy.test(resolvedAst1, resolvedAst1, 'kind', resolvedAst1.kind, | 1000 if (!strategy.test(resolvedAst1, resolvedAst1, 'kind', resolvedAst1.kind, |
| 1003 resolvedAst2.kind)) { | 1001 resolvedAst2.kind)) { |
| 1004 return false; | 1002 return false; |
| 1005 } | 1003 } |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 } | 2031 } |
| 2034 | 2032 |
| 2035 bool areMetadataAnnotationsEquivalent( | 2033 bool areMetadataAnnotationsEquivalent( |
| 2036 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 2034 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
| 2037 if (metadata1 == metadata2) return true; | 2035 if (metadata1 == metadata2) return true; |
| 2038 if (metadata1 == null || metadata2 == null) return false; | 2036 if (metadata1 == null || metadata2 == null) return false; |
| 2039 return areElementsEquivalent( | 2037 return areElementsEquivalent( |
| 2040 metadata1.annotatedElement, metadata2.annotatedElement) && | 2038 metadata1.annotatedElement, metadata2.annotatedElement) && |
| 2041 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 2039 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
| 2042 } | 2040 } |
| OLD | NEW |