| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_test_helper; | 5 library dart2js.serialization_test_helper; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'package:compiler/src/common/resolution.dart'; | 8 import 'package:compiler/src/common/resolution.dart'; |
| 9 import 'package:compiler/src/constants/expressions.dart'; | 9 import 'package:compiler/src/constants/expressions.dart'; |
| 10 import 'package:compiler/src/constants/values.dart'; | 10 import 'package:compiler/src/constants/values.dart'; |
| 11 import 'package:compiler/src/compiler.dart'; | 11 import 'package:compiler/src/compiler.dart'; |
| 12 import 'package:compiler/src/elements/elements.dart'; | 12 import 'package:compiler/src/elements/elements.dart'; |
| 13 import 'package:compiler/src/elements/entities.dart'; | 13 import 'package:compiler/src/elements/entities.dart'; |
| 14 import 'package:compiler/src/elements/resolution_types.dart'; | 14 import 'package:compiler/src/elements/resolution_types.dart'; |
| 15 import 'package:compiler/src/elements/types.dart'; | 15 import 'package:compiler/src/elements/types.dart'; |
| 16 import 'package:compiler/src/kernel/elements.dart'; | 16 import 'package:compiler/src/kernel/elements.dart'; |
| 17 import 'package:compiler/src/kernel/world_builder.dart'; | 17 import 'package:compiler/src/kernel/element_map.dart'; |
| 18 import 'package:compiler/src/serialization/equivalence.dart'; | 18 import 'package:compiler/src/serialization/equivalence.dart'; |
| 19 import 'package:compiler/src/util/util.dart'; | 19 import 'package:compiler/src/util/util.dart'; |
| 20 import 'package:expect/expect.dart'; | 20 import 'package:expect/expect.dart'; |
| 21 import 'test_data.dart'; | 21 import 'test_data.dart'; |
| 22 | 22 |
| 23 Check currentCheck; | 23 Check currentCheck; |
| 24 | 24 |
| 25 class Check { | 25 class Check { |
| 26 final Check parent; | 26 final Check parent; |
| 27 final Object object1; | 27 final Object object1; |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 final WorldDeconstructionForTesting testing; | 638 final WorldDeconstructionForTesting testing; |
| 639 | 639 |
| 640 /// Set of mixin applications assumed to be equivalent. | 640 /// Set of mixin applications assumed to be equivalent. |
| 641 /// | 641 /// |
| 642 /// We need co-inductive reasoning because mixin applications are compared | 642 /// We need co-inductive reasoning because mixin applications are compared |
| 643 /// structurally and therefore, in the case of generic mixin applications, | 643 /// structurally and therefore, in the case of generic mixin applications, |
| 644 /// meet themselves through the equivalence check of their type variables. | 644 /// meet themselves through the equivalence check of their type variables. |
| 645 Set<Pair<ClassEntity, ClassEntity>> assumedMixinApplications = | 645 Set<Pair<ClassEntity, ClassEntity>> assumedMixinApplications = |
| 646 new Set<Pair<ClassEntity, ClassEntity>>(); | 646 new Set<Pair<ClassEntity, ClassEntity>>(); |
| 647 | 647 |
| 648 KernelEquivalence(KernelWorldBuilder builder) | 648 KernelEquivalence(KernelToElementMap builder) |
| 649 : testing = new WorldDeconstructionForTesting(builder); | 649 : testing = new WorldDeconstructionForTesting(builder); |
| 650 | 650 |
| 651 TestStrategy get defaultStrategy => new TestStrategy( | 651 TestStrategy get defaultStrategy => new TestStrategy( |
| 652 elementEquivalence: entityEquivalence, typeEquivalence: typeEquivalence); | 652 elementEquivalence: entityEquivalence, typeEquivalence: typeEquivalence); |
| 653 | 653 |
| 654 bool entityEquivalence(Element a, Entity b, {TestStrategy strategy}) { | 654 bool entityEquivalence(Element a, Entity b, {TestStrategy strategy}) { |
| 655 if (identical(a, b)) return true; | 655 if (identical(a, b)) return true; |
| 656 if (a == null || b == null) return false; | 656 if (a == null || b == null) return false; |
| 657 strategy ??= defaultStrategy; | 657 strategy ??= defaultStrategy; |
| 658 switch (a.kind) { | 658 switch (a.kind) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 strategy.testTypeLists(a, b, 'namedParameterTypes', | 821 strategy.testTypeLists(a, b, 'namedParameterTypes', |
| 822 aType.namedParameterTypes, b.namedParameterTypes); | 822 aType.namedParameterTypes, b.namedParameterTypes); |
| 823 } | 823 } |
| 824 return false; | 824 return false; |
| 825 default: | 825 default: |
| 826 throw new UnsupportedError('Unsupported equivalence: ' | 826 throw new UnsupportedError('Unsupported equivalence: ' |
| 827 '$a (${a.runtimeType}) vs $b (${b.runtimeType})'); | 827 '$a (${a.runtimeType}) vs $b (${b.runtimeType})'); |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 } | 830 } |
| OLD | NEW |