| 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'; |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 return false; | 656 return false; |
| 657 case ElementKind.FACTORY_CONSTRUCTOR: | 657 case ElementKind.FACTORY_CONSTRUCTOR: |
| 658 if (b is KFactoryConstructor) { | 658 if (b is KFactoryConstructor) { |
| 659 return strategy.test(a, b, 'name', a.name, b.name) && | 659 return strategy.test(a, b, 'name', a.name, b.name) && |
| 660 strategy.testElements( | 660 strategy.testElements( |
| 661 a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass); | 661 a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass); |
| 662 } | 662 } |
| 663 return false; | 663 return false; |
| 664 case ElementKind.CLASS: | 664 case ElementKind.CLASS: |
| 665 if (b is KClass) { | 665 if (b is KClass) { |
| 666 List<InterfaceType> aMixinTypes = []; |
| 667 List<InterfaceType> bMixinTypes = []; |
| 668 ClassElement aClass = a; |
| 669 while (aClass.isMixinApplication) { |
| 670 MixinApplicationElement aMixinApplication = aClass; |
| 671 aMixinTypes.add(aMixinApplication.mixinType); |
| 672 aClass = aMixinApplication.superclass; |
| 673 } |
| 674 KClass bClass = b; |
| 675 while (bClass != null) { |
| 676 InterfaceType mixinType = testing.getMixinTypeForClass(bClass); |
| 677 if (mixinType == null) break; |
| 678 bMixinTypes.add(mixinType); |
| 679 bClass = testing.getSuperclassForClass(bClass); |
| 680 } |
| 681 if (aMixinTypes.isNotEmpty || aMixinTypes.isNotEmpty) { |
| 682 if (aClass.isNamedMixinApplication && |
| 683 !strategy.test(a, b, 'name', a.name, b.name)) { |
| 684 return false; |
| 685 } |
| 686 return strategy.testTypeLists( |
| 687 a, b, 'mixinTypes', aMixinTypes, bMixinTypes); |
| 688 } |
| 666 return strategy.test(a, b, 'name', a.name, b.name) && | 689 return strategy.test(a, b, 'name', a.name, b.name) && |
| 667 strategy.testElements( | 690 strategy.testElements( |
| 668 a, b, 'library', a.library, testing.getLibraryForClass(b)); | 691 a, b, 'library', a.library, testing.getLibraryForClass(b)); |
| 669 } | 692 } |
| 670 return false; | 693 return false; |
| 671 case ElementKind.LIBRARY: | 694 case ElementKind.LIBRARY: |
| 672 if (b is KLibrary) { | 695 if (b is KLibrary) { |
| 673 LibraryElement libraryA = a; | 696 LibraryElement libraryA = a; |
| 674 return libraryA.canonicalUri == testing.getLibraryUri(b); | 697 return libraryA.canonicalUri == testing.getLibraryUri(b); |
| 675 } | 698 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 strategy.testTypeLists(a, b, 'namedParameterTypes', | 803 strategy.testTypeLists(a, b, 'namedParameterTypes', |
| 781 aType.namedParameterTypes, b.namedParameterTypes); | 804 aType.namedParameterTypes, b.namedParameterTypes); |
| 782 } | 805 } |
| 783 return false; | 806 return false; |
| 784 default: | 807 default: |
| 785 throw new UnsupportedError('Unsupported equivalence: ' | 808 throw new UnsupportedError('Unsupported equivalence: ' |
| 786 '$a (${a.runtimeType}) vs $b (${b.runtimeType})'); | 809 '$a (${a.runtimeType}) vs $b (${b.runtimeType})'); |
| 787 } | 810 } |
| 788 } | 811 } |
| 789 } | 812 } |
| OLD | NEW |