| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 verbose: verbose); | 100 verbose: verbose); |
| 101 checkClosedWorlds(compilerNormal.resolverWorld.closedWorldForTesting, | 101 checkClosedWorlds(compilerNormal.resolverWorld.closedWorldForTesting, |
| 102 compilerDeserialized.resolverWorld.closedWorldForTesting, | 102 compilerDeserialized.resolverWorld.closedWorldForTesting, |
| 103 verbose: verbose); | 103 verbose: verbose); |
| 104 checkBackendInfo(compilerNormal, compilerDeserialized, verbose: verbose); | 104 checkBackendInfo(compilerNormal, compilerDeserialized, verbose: verbose); |
| 105 }); | 105 }); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void checkResolutionEnqueuers( | 108 void checkResolutionEnqueuers( |
| 109 ResolutionEnqueuer enqueuer1, ResolutionEnqueuer enqueuer2, | 109 ResolutionEnqueuer enqueuer1, ResolutionEnqueuer enqueuer2, |
| 110 {bool typeEquivalence(DartType a, DartType b): areTypesEquivalent, | 110 {bool typeEquivalence(ResolutionDartType a, ResolutionDartType b): |
| 111 areTypesEquivalent, |
| 111 bool elementFilter(Element element), | 112 bool elementFilter(Element element), |
| 112 bool verbose: false}) { | 113 bool verbose: false}) { |
| 113 checkSets(enqueuer1.processedEntities, enqueuer2.processedEntities, | 114 checkSets(enqueuer1.processedEntities, enqueuer2.processedEntities, |
| 114 "Processed element mismatch", areElementsEquivalent, | 115 "Processed element mismatch", areElementsEquivalent, |
| 115 elementFilter: elementFilter, verbose: verbose); | 116 elementFilter: elementFilter, verbose: verbose); |
| 116 | 117 |
| 117 ResolutionWorldBuilderImpl worldBuilder1 = enqueuer1.universe; | 118 ResolutionWorldBuilderImpl worldBuilder1 = enqueuer1.universe; |
| 118 ResolutionWorldBuilderImpl worldBuilder2 = enqueuer2.universe; | 119 ResolutionWorldBuilderImpl worldBuilder2 = enqueuer2.universe; |
| 119 | 120 |
| 120 checkMaps( | 121 checkMaps( |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 outputUnit1.isMainOutput, outputUnit2.isMainOutput); | 418 outputUnit1.isMainOutput, outputUnit2.isMainOutput); |
| 418 checkSetEquivalence( | 419 checkSetEquivalence( |
| 419 outputUnit1, | 420 outputUnit1, |
| 420 outputUnit2, | 421 outputUnit2, |
| 421 'OutputUnit.imports $message', | 422 'OutputUnit.imports $message', |
| 422 outputUnit1.imports, | 423 outputUnit1.imports, |
| 423 outputUnit2.imports, | 424 outputUnit2.imports, |
| 424 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); | 425 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); |
| 425 } | 426 } |
| 426 | 427 |
| 427 bool areInstantiationInfosEquivalent(InstantiationInfo info1, | 428 bool areInstantiationInfosEquivalent( |
| 428 InstantiationInfo info2, bool typeEquivalence(DartType a, DartType b)) { | 429 InstantiationInfo info1, |
| 430 InstantiationInfo info2, |
| 431 bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) { |
| 429 checkMaps( | 432 checkMaps( |
| 430 info1.instantiationMap, | 433 info1.instantiationMap, |
| 431 info2.instantiationMap, | 434 info2.instantiationMap, |
| 432 'instantiationMap of\n ' | 435 'instantiationMap of\n ' |
| 433 '${info1.instantiationMap}\nvs ${info2.instantiationMap}', | 436 '${info1.instantiationMap}\nvs ${info2.instantiationMap}', |
| 434 areElementsEquivalent, | 437 areElementsEquivalent, |
| 435 (a, b) => areSetsEquivalent( | 438 (a, b) => areSetsEquivalent( |
| 436 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); | 439 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); |
| 437 return true; | 440 return true; |
| 438 } | 441 } |
| 439 | 442 |
| 440 bool areInstancesEquivalent(Instance instance1, Instance instance2, | 443 bool areInstancesEquivalent(Instance instance1, Instance instance2, |
| 441 bool typeEquivalence(DartType a, DartType b)) { | 444 bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) { |
| 442 return typeEquivalence(instance1.type, instance2.type) && | 445 return typeEquivalence(instance1.type, instance2.type) && |
| 443 instance1.kind == instance2.kind && | 446 instance1.kind == instance2.kind && |
| 444 instance1.isRedirection == instance2.isRedirection; | 447 instance1.isRedirection == instance2.isRedirection; |
| 445 } | 448 } |
| OLD | NEW |