| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// Equivalence test functions for data objects. | 5 /// Equivalence test functions for data objects. |
| 6 | 6 |
| 7 library dart2js.equivalence.functions; | 7 library dart2js.equivalence.functions; |
| 8 | 8 |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import 'package:compiler/src/common/resolution.dart'; | 10 import 'package:compiler/src/common/resolution.dart'; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 data1.nativeFieldStoreBehavior, | 91 data1.nativeFieldStoreBehavior, |
| 92 data2.nativeFieldStoreBehavior, | 92 data2.nativeFieldStoreBehavior, |
| 93 strategy.elementEquivalence, | 93 strategy.elementEquivalence, |
| 94 (a, b) => testNativeBehavior(a, b, strategy: strategy), | 94 (a, b) => testNativeBehavior(a, b, strategy: strategy), |
| 95 allowExtra: allowExtra); | 95 allowExtra: allowExtra); |
| 96 | 96 |
| 97 checkMapEquivalence( | 97 checkMapEquivalence( |
| 98 data1, | 98 data1, |
| 99 data2, | 99 data2, |
| 100 'jsInteropLibraryNames', | 100 'jsInteropLibraryNames', |
| 101 data1.jsInteropLibraryNames, | 101 data1.jsInteropLibraries, |
| 102 data2.jsInteropLibraryNames, | 102 data2.jsInteropLibraries, |
| 103 strategy.elementEquivalence, | 103 strategy.elementEquivalence, |
| 104 equality); | 104 equality); |
| 105 | 105 |
| 106 checkSetEquivalence( | 106 checkSetEquivalence( |
| 107 data1, | 107 data1, |
| 108 data2, | 108 data2, |
| 109 'anonymousJsInteropClasses', | 109 'anonymousJsInteropClasses', |
| 110 data1.anonymousJsInteropClasses, | 110 data1.anonymousJsInteropClasses, |
| 111 data2.anonymousJsInteropClasses, | 111 data2.anonymousJsInteropClasses, |
| 112 strategy.elementEquivalence); | 112 strategy.elementEquivalence); |
| 113 | 113 |
| 114 checkMapEquivalence( | 114 checkMapEquivalence( |
| 115 data1, | 115 data1, |
| 116 data2, | 116 data2, |
| 117 'jsInteropClassNames', | 117 'jsInteropClassNames', |
| 118 data1.jsInteropClassNames, | 118 data1.jsInteropClasses, |
| 119 data2.jsInteropClassNames, | 119 data2.jsInteropClasses, |
| 120 strategy.elementEquivalence, | 120 strategy.elementEquivalence, |
| 121 equality); | 121 equality); |
| 122 | 122 |
| 123 checkMapEquivalence( | 123 checkMapEquivalence( |
| 124 data1, | 124 data1, |
| 125 data2, | 125 data2, |
| 126 'jsInteropMemberNames', | 126 'jsInteropMemberNames', |
| 127 data1.jsInteropMemberNames, | 127 data1.jsInteropMembers, |
| 128 data2.jsInteropMemberNames, | 128 data2.jsInteropMembers, |
| 129 strategy.elementEquivalence, | 129 strategy.elementEquivalence, |
| 130 equality); | 130 equality); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void checkInterceptorData(InterceptorDataImpl data1, InterceptorDataImpl data2, | 133 void checkInterceptorData(InterceptorDataImpl data1, InterceptorDataImpl data2, |
| 134 bool elementEquivalence(Entity a, Entity b), | 134 bool elementEquivalence(Entity a, Entity b), |
| 135 {bool verbose: false}) { | 135 {bool verbose: false}) { |
| 136 checkMapEquivalence( | 136 checkMapEquivalence( |
| 137 data1, | 137 data1, |
| 138 data2, | 138 data2, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 data2, | 379 data2, |
| 380 'nativeClassTagInfo', | 380 'nativeClassTagInfo', |
| 381 data1.nativeClassTagInfo, | 381 data1.nativeClassTagInfo, |
| 382 data2.nativeClassTagInfo, | 382 data2.nativeClassTagInfo, |
| 383 strategy.elementEquivalence, | 383 strategy.elementEquivalence, |
| 384 (a, b) => a == b); | 384 (a, b) => a == b); |
| 385 checkSetEquivalence( | 385 checkSetEquivalence( |
| 386 data1, | 386 data1, |
| 387 data2, | 387 data2, |
| 388 'jsInteropLibraries', | 388 'jsInteropLibraries', |
| 389 data1.jsInteropLibraries, | 389 data1.jsInteropLibraries.keys, |
| 390 data2.jsInteropLibraries, | 390 data2.jsInteropLibraries.keys, |
| 391 strategy.elementEquivalence); | 391 strategy.elementEquivalence); |
| 392 checkSetEquivalence(data1, data2, 'jsInteropClasses', data1.jsInteropClasses, | 392 checkSetEquivalence( |
| 393 data2.jsInteropClasses, strategy.elementEquivalence); | 393 data1, |
| 394 data2, |
| 395 'jsInteropClasses', |
| 396 data1.jsInteropClasses.keys, |
| 397 data2.jsInteropClasses.keys, |
| 398 strategy.elementEquivalence); |
| 394 } | 399 } |
| 395 | 400 |
| 396 void checkBackendUsage( | 401 void checkBackendUsage( |
| 397 BackendUsageImpl usage1, BackendUsageImpl usage2, TestStrategy strategy) { | 402 BackendUsageImpl usage1, BackendUsageImpl usage2, TestStrategy strategy) { |
| 398 checkSetEquivalence( | 403 checkSetEquivalence( |
| 399 usage1, | 404 usage1, |
| 400 usage2, | 405 usage2, |
| 401 'globalClassDependencies', | 406 'globalClassDependencies', |
| 402 usage1.globalClassDependencies, | 407 usage1.globalClassDependencies, |
| 403 usage2.globalClassDependencies, | 408 usage2.globalClassDependencies, |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 print(' ${js.nodeToString(node1)}'); | 1179 print(' ${js.nodeToString(node1)}'); |
| 1175 print(' ${js.nodeToString(node2)}'); | 1180 print(' ${js.nodeToString(node2)}'); |
| 1176 } | 1181 } |
| 1177 return expectedValue == label2; | 1182 return expectedValue == label2; |
| 1178 } else { | 1183 } else { |
| 1179 labelsMap[label1] = label2; | 1184 labelsMap[label1] = label2; |
| 1180 return true; | 1185 return true; |
| 1181 } | 1186 } |
| 1182 } | 1187 } |
| 1183 } | 1188 } |
| OLD | NEW |