| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 "JavaScriptBackend.hasRuntimeTypeSupport mismatch"); | 155 "JavaScriptBackend.hasRuntimeTypeSupport mismatch"); |
| 156 Expect.equals(backend1.hasIsolateSupport, backend2.hasIsolateSupport, | 156 Expect.equals(backend1.hasIsolateSupport, backend2.hasIsolateSupport, |
| 157 "JavaScriptBackend.hasIsolateSupport mismatch"); | 157 "JavaScriptBackend.hasIsolateSupport mismatch"); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void checkClosedWorlds(ClosedWorld closedWorld1, ClosedWorld closedWorld2, | 160 void checkClosedWorlds(ClosedWorld closedWorld1, ClosedWorld closedWorld2, |
| 161 {bool verbose: false}) { | 161 {bool verbose: false}) { |
| 162 checkClassHierarchyNodes( | 162 checkClassHierarchyNodes( |
| 163 closedWorld1, | 163 closedWorld1, |
| 164 closedWorld2, | 164 closedWorld2, |
| 165 closedWorld1.getClassHierarchyNode(closedWorld1.coreClasses.objectClass), | 165 closedWorld1 |
| 166 closedWorld2.getClassHierarchyNode(closedWorld2.coreClasses.objectClass), | 166 .getClassHierarchyNode(closedWorld1.commonElements.objectClass), |
| 167 closedWorld2 |
| 168 .getClassHierarchyNode(closedWorld2.commonElements.objectClass), |
| 167 verbose: verbose); | 169 verbose: verbose); |
| 168 } | 170 } |
| 169 | 171 |
| 170 void checkBackendInfo(Compiler compilerNormal, Compiler compilerDeserialized, | 172 void checkBackendInfo(Compiler compilerNormal, Compiler compilerDeserialized, |
| 171 {bool verbose: false}) { | 173 {bool verbose: false}) { |
| 172 checkSets( | 174 checkSets( |
| 173 compilerNormal.enqueuer.resolution.processedEntities, | 175 compilerNormal.enqueuer.resolution.processedEntities, |
| 174 compilerDeserialized.enqueuer.resolution.processedEntities, | 176 compilerDeserialized.enqueuer.resolution.processedEntities, |
| 175 "Processed element mismatch", | 177 "Processed element mismatch", |
| 176 areElementsEquivalent, onSameElement: (a, b) { | 178 areElementsEquivalent, onSameElement: (a, b) { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 checkClassHierarchyNodes(closedWorld1, closedWorld2, child, other, | 329 checkClassHierarchyNodes(closedWorld1, closedWorld2, child, other, |
| 328 verbose: verbose); | 330 verbose: verbose); |
| 329 found = true; | 331 found = true; |
| 330 break; | 332 break; |
| 331 } | 333 } |
| 332 } | 334 } |
| 333 if (!found) { | 335 if (!found) { |
| 334 if (child.isInstantiated) { | 336 if (child.isInstantiated) { |
| 335 print('Missing subclass ${child.cls} of ${node1.cls} ' | 337 print('Missing subclass ${child.cls} of ${node1.cls} ' |
| 336 'in ${node2.directSubclasses}'); | 338 'in ${node2.directSubclasses}'); |
| 337 print(closedWorld1 | 339 print(closedWorld1.dump( |
| 338 .dump(verbose ? closedWorld1.coreClasses.objectClass : node1.cls)); | 340 verbose ? closedWorld1.commonElements.objectClass : node1.cls)); |
| 339 print(closedWorld2 | 341 print(closedWorld2.dump( |
| 340 .dump(verbose ? closedWorld2.coreClasses.objectClass : node2.cls)); | 342 verbose ? closedWorld2.commonElements.objectClass : node2.cls)); |
| 341 } | 343 } |
| 342 Expect.isFalse( | 344 Expect.isFalse( |
| 343 child.isInstantiated, | 345 child.isInstantiated, |
| 344 'Missing subclass ${child.cls} of ${node1.cls} in ' | 346 'Missing subclass ${child.cls} of ${node1.cls} in ' |
| 345 '${node2.directSubclasses}'); | 347 '${node2.directSubclasses}'); |
| 346 } | 348 } |
| 347 } | 349 } |
| 348 checkMixinUses(closedWorld1, closedWorld2, node1.cls, node2.cls, | 350 checkMixinUses(closedWorld1, closedWorld2, node1.cls, node2.cls, |
| 349 verbose: verbose); | 351 verbose: verbose); |
| 350 } | 352 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); | 436 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); |
| 435 return true; | 437 return true; |
| 436 } | 438 } |
| 437 | 439 |
| 438 bool areInstancesEquivalent(Instance instance1, Instance instance2, | 440 bool areInstancesEquivalent(Instance instance1, Instance instance2, |
| 439 bool typeEquivalence(DartType a, DartType b)) { | 441 bool typeEquivalence(DartType a, DartType b)) { |
| 440 return typeEquivalence(instance1.type, instance2.type) && | 442 return typeEquivalence(instance1.type, instance2.type) && |
| 441 instance1.kind == instance2.kind && | 443 instance1.kind == instance2.kind && |
| 442 instance1.isRedirection == instance2.isRedirection; | 444 instance1.isRedirection == instance2.isRedirection; |
| 443 } | 445 } |
| OLD | NEW |