OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.serialization_model_test; | 5 library dart2js.serialization_model_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void checkResolutionEnqueuers( | 114 void checkResolutionEnqueuers( |
115 BackendUsage backendUsage1, | 115 BackendUsage backendUsage1, |
116 BackendUsage backendUsage2, | 116 BackendUsage backendUsage2, |
117 ResolutionEnqueuer enqueuer1, | 117 ResolutionEnqueuer enqueuer1, |
118 ResolutionEnqueuer enqueuer2, | 118 ResolutionEnqueuer enqueuer2, |
119 {bool typeEquivalence(ResolutionDartType a, ResolutionDartType b): | 119 {bool typeEquivalence(ResolutionDartType a, ResolutionDartType b): |
120 areTypesEquivalent, | 120 areTypesEquivalent, |
121 bool elementFilter(Element element), | 121 bool elementFilter(Element element), |
122 bool verbose: false}) { | 122 bool verbose: false}) { |
123 checkSets(enqueuer1.processedEntities, enqueuer2.processedEntities, | 123 checkSets(enqueuer1.processedEntities, enqueuer2.processedEntities, |
124 "Processed element mismatch", areElementsEquivalent, | 124 "Processed element mismatch", areElementsEquivalent, elementFilter: (e) { |
125 elementFilter: elementFilter, verbose: verbose); | 125 return elementFilter != null ? elementFilter(e) : true; |
| 126 }, verbose: verbose); |
126 | 127 |
127 ElementResolutionWorldBuilder worldBuilder1 = enqueuer1.worldBuilder; | 128 ElementResolutionWorldBuilder worldBuilder1 = enqueuer1.worldBuilder; |
128 ElementResolutionWorldBuilder worldBuilder2 = enqueuer2.worldBuilder; | 129 ElementResolutionWorldBuilder worldBuilder2 = enqueuer2.worldBuilder; |
129 | 130 |
130 checkMaps( | 131 checkMaps( |
131 worldBuilder1.getInstantiationMap(), | 132 worldBuilder1.getInstantiationMap(), |
132 worldBuilder2.getInstantiationMap(), | 133 worldBuilder2.getInstantiationMap(), |
133 "Instantiated classes mismatch", | 134 "Instantiated classes mismatch", |
134 areElementsEquivalent, | 135 areElementsEquivalent, |
135 (a, b) => areInstantiationInfosEquivalent(a, b, typeEquivalence), | 136 (a, b) => areInstantiationInfosEquivalent(a, b, typeEquivalence), |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 } | 455 } |
455 | 456 |
456 bool areInstancesEquivalent(Instance instance1, Instance instance2, | 457 bool areInstancesEquivalent(Instance instance1, Instance instance2, |
457 bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) { | 458 bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) { |
458 ResolutionInterfaceType type1 = instance1.type; | 459 ResolutionInterfaceType type1 = instance1.type; |
459 ResolutionInterfaceType type2 = instance2.type; | 460 ResolutionInterfaceType type2 = instance2.type; |
460 return typeEquivalence(type1, type2) && | 461 return typeEquivalence(type1, type2) && |
461 instance1.kind == instance2.kind && | 462 instance1.kind == instance2.kind && |
462 instance1.isRedirection == instance2.isRedirection; | 463 instance1.isRedirection == instance2.isRedirection; |
463 } | 464 } |
OLD | NEW |