| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 }, verbose: verbose); | 127 }, verbose: verbose); |
| 128 | 128 |
| 129 ResolutionWorldBuilderBase worldBuilder1 = enqueuer1.worldBuilder; | 129 ResolutionWorldBuilderBase worldBuilder1 = enqueuer1.worldBuilder; |
| 130 ResolutionWorldBuilderBase worldBuilder2 = enqueuer2.worldBuilder; | 130 ResolutionWorldBuilderBase worldBuilder2 = enqueuer2.worldBuilder; |
| 131 | 131 |
| 132 checkMaps( | 132 checkMaps( |
| 133 worldBuilder1.getInstantiationMap(), | 133 worldBuilder1.getInstantiationMap(), |
| 134 worldBuilder2.getInstantiationMap(), | 134 worldBuilder2.getInstantiationMap(), |
| 135 "Instantiated classes mismatch", | 135 "Instantiated classes mismatch", |
| 136 elementEquivalence, | 136 elementEquivalence, |
| 137 (a, b) => areInstantiationInfosEquivalent(a, b, typeEquivalence), | 137 (a, b) => areInstantiationInfosEquivalent( |
| 138 a, b, elementEquivalence, typeEquivalence), |
| 138 verbose: verbose); | 139 verbose: verbose); |
| 139 | 140 |
| 140 checkSets( | 141 checkSets( |
| 141 enqueuer1.worldBuilder.directlyInstantiatedClasses, | 142 enqueuer1.worldBuilder.directlyInstantiatedClasses, |
| 142 enqueuer2.worldBuilder.directlyInstantiatedClasses, | 143 enqueuer2.worldBuilder.directlyInstantiatedClasses, |
| 143 "Directly instantiated classes mismatch", | 144 "Directly instantiated classes mismatch", |
| 144 elementEquivalence, | 145 elementEquivalence, |
| 145 verbose: verbose); | 146 verbose: verbose); |
| 146 | 147 |
| 147 checkSets( | 148 checkSets( |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 outputUnit2, | 437 outputUnit2, |
| 437 'OutputUnit.imports $message', | 438 'OutputUnit.imports $message', |
| 438 outputUnit1.imports, | 439 outputUnit1.imports, |
| 439 outputUnit2.imports, | 440 outputUnit2.imports, |
| 440 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); | 441 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); |
| 441 } | 442 } |
| 442 | 443 |
| 443 bool areInstantiationInfosEquivalent( | 444 bool areInstantiationInfosEquivalent( |
| 444 InstantiationInfo info1, | 445 InstantiationInfo info1, |
| 445 InstantiationInfo info2, | 446 InstantiationInfo info2, |
| 446 bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) { | 447 bool elementEquivalence(Entity a, Entity b), |
| 448 bool typeEquivalence(DartType a, DartType b)) { |
| 447 checkMaps( | 449 checkMaps( |
| 448 info1.instantiationMap, | 450 info1.instantiationMap, |
| 449 info2.instantiationMap, | 451 info2.instantiationMap, |
| 450 'instantiationMap of\n ' | 452 'instantiationMap of\n ' |
| 451 '${info1.instantiationMap}\nvs ${info2.instantiationMap}', | 453 '${info1.instantiationMap}\nvs ${info2.instantiationMap}', |
| 452 areElementsEquivalent, | 454 elementEquivalence, |
| 453 (a, b) => areSetsEquivalent( | 455 (a, b) => areSetsEquivalent( |
| 454 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); | 456 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); |
| 455 return true; | 457 return true; |
| 456 } | 458 } |
| 457 | 459 |
| 458 bool areInstancesEquivalent(Instance instance1, Instance instance2, | 460 bool areInstancesEquivalent(Instance instance1, Instance instance2, |
| 459 bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) { | 461 bool typeEquivalence(DartType a, DartType b)) { |
| 460 ResolutionInterfaceType type1 = instance1.type; | 462 InterfaceType type1 = instance1.type; |
| 461 ResolutionInterfaceType type2 = instance2.type; | 463 InterfaceType type2 = instance2.type; |
| 462 return typeEquivalence(type1, type2) && | 464 return typeEquivalence(type1, type2) && |
| 463 instance1.kind == instance2.kind && | 465 instance1.kind == instance2.kind && |
| 464 instance1.isRedirection == instance2.isRedirection; | 466 instance1.isRedirection == instance2.isRedirection; |
| 465 } | 467 } |
| OLD | NEW |