| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.element; | 8 library engine.element; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 6794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6805 * @param second the second set of types to be intersected | 6805 * @param second the second set of types to be intersected |
| 6806 * @return the intersection of the given sets of types | 6806 * @return the intersection of the given sets of types |
| 6807 */ | 6807 */ |
| 6808 static List<InterfaceType> _intersection(Set<InterfaceType> first, Set<Interfa
ceType> second) { | 6808 static List<InterfaceType> _intersection(Set<InterfaceType> first, Set<Interfa
ceType> second) { |
| 6809 Set<InterfaceType> result = new HashSet<InterfaceType>.from(first); | 6809 Set<InterfaceType> result = new HashSet<InterfaceType>.from(first); |
| 6810 result.retainAll(second); | 6810 result.retainAll(second); |
| 6811 return new List.from(result); | 6811 return new List.from(result); |
| 6812 } | 6812 } |
| 6813 | 6813 |
| 6814 /** | 6814 /** |
| 6815 * Return the "least upper bound" of the given types under the assumption that
the types have the | |
| 6816 * same element and differ only in terms of the type arguments. The resulting
type is composed by | |
| 6817 * comparing the corresponding type arguments, keeping those that are the same
, and using | |
| 6818 * 'dynamic' for those that are different. | |
| 6819 * | |
| 6820 * @param firstType the first type | |
| 6821 * @param secondType the second type | |
| 6822 * @return the "least upper bound" of the given types | |
| 6823 */ | |
| 6824 static InterfaceType _leastUpperBound(InterfaceType firstType, InterfaceType s
econdType) { | |
| 6825 if (firstType == secondType) { | |
| 6826 return firstType; | |
| 6827 } | |
| 6828 List<DartType> firstArguments = firstType.typeArguments; | |
| 6829 List<DartType> secondArguments = secondType.typeArguments; | |
| 6830 int argumentCount = firstArguments.length; | |
| 6831 if (argumentCount == 0) { | |
| 6832 return firstType; | |
| 6833 } | |
| 6834 List<DartType> lubArguments = new List<DartType>(argumentCount); | |
| 6835 for (int i = 0; i < argumentCount; i++) { | |
| 6836 // | |
| 6837 // Ideally we would take the least upper bound of the two argument types,
but this can cause | |
| 6838 // an infinite recursion (such as when finding the least upper bound of St
ring and num). | |
| 6839 // | |
| 6840 if (firstArguments[i] == secondArguments[i]) { | |
| 6841 lubArguments[i] = firstArguments[i]; | |
| 6842 } | |
| 6843 if (lubArguments[i] == null) { | |
| 6844 lubArguments[i] = DynamicTypeImpl.instance; | |
| 6845 } | |
| 6846 } | |
| 6847 InterfaceTypeImpl lub = new InterfaceTypeImpl.con1(firstType.element); | |
| 6848 lub.typeArguments = lubArguments; | |
| 6849 return lub; | |
| 6850 } | |
| 6851 | |
| 6852 /** | |
| 6853 * An array containing the actual types of the type arguments. | 6815 * An array containing the actual types of the type arguments. |
| 6854 */ | 6816 */ |
| 6855 List<DartType> typeArguments = TypeImpl.EMPTY_ARRAY; | 6817 List<DartType> typeArguments = TypeImpl.EMPTY_ARRAY; |
| 6856 | 6818 |
| 6857 /** | 6819 /** |
| 6858 * Initialize a newly created type to be declared by the given element. | 6820 * Initialize a newly created type to be declared by the given element. |
| 6859 * | 6821 * |
| 6860 * @param element the element representing the declaration of the type | 6822 * @param element the element representing the declaration of the type |
| 6861 */ | 6823 */ |
| 6862 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN
ame); | 6824 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN
ame); |
| (...skipping 4914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11777 if (type is UnionType) { | 11739 if (type is UnionType) { |
| 11778 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite
dTypePairs); | 11740 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite
dTypePairs); |
| 11779 } | 11741 } |
| 11780 // The only subtype relations that pertain to void are therefore: | 11742 // The only subtype relations that pertain to void are therefore: |
| 11781 // void <: void (by reflexivity) | 11743 // void <: void (by reflexivity) |
| 11782 // bottom <: void (as bottom is a subtype of all types). | 11744 // bottom <: void (as bottom is a subtype of all types). |
| 11783 // void <: dynamic (as dynamic is a supertype of all types) | 11745 // void <: dynamic (as dynamic is a supertype of all types) |
| 11784 return identical(type, this) || type.isDynamic; | 11746 return identical(type, this) || type.isDynamic; |
| 11785 } | 11747 } |
| 11786 } | 11748 } |
| OLD | NEW |