| 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 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2714 /** | 2714 /** |
| 2715 * Return `true` if this type is a supertype of the given type. A type <i>S</i
> is a | 2715 * Return `true` if this type is a supertype of the given type. A type <i>S</i
> is a |
| 2716 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt
ype of <i>S</i>. | 2716 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt
ype of <i>S</i>. |
| 2717 * | 2717 * |
| 2718 * @param type the type being compared with this type | 2718 * @param type the type being compared with this type |
| 2719 * @return `true` if this type is a supertype of the given type | 2719 * @return `true` if this type is a supertype of the given type |
| 2720 */ | 2720 */ |
| 2721 bool isSupertypeOf(DartType type); | 2721 bool isSupertypeOf(DartType type); |
| 2722 | 2722 |
| 2723 /** | 2723 /** |
| 2724 * Return `true` if this type represents a typename that couldn't be |
| 2725 * resolved. |
| 2726 */ |
| 2727 bool get isUndefined; |
| 2728 |
| 2729 /** |
| 2724 * Return `true` if this type represents the type 'void'. | 2730 * Return `true` if this type represents the type 'void'. |
| 2725 * | 2731 * |
| 2726 * @return `true` if this type represents the type 'void' | 2732 * @return `true` if this type represents the type 'void' |
| 2727 */ | 2733 */ |
| 2728 bool get isVoid; | 2734 bool get isVoid; |
| 2729 | 2735 |
| 2730 /** | 2736 /** |
| 2731 * Return the type resulting from substituting the given arguments for the giv
en parameters in | 2737 * Return the type resulting from substituting the given arguments for the giv
en parameters in |
| 2732 * this type. The specification defines this operation in section 2: <blockquo
te> The notation | 2738 * this type. The specification defines this operation in section 2: <blockquo
te> The notation |
| 2733 * <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>]E</
i> denotes a copy of | 2739 * <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>]E</
i> denotes a copy of |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2828 ElementKind get kind => ElementKind.DYNAMIC; | 2834 ElementKind get kind => ElementKind.DYNAMIC; |
| 2829 } | 2835 } |
| 2830 | 2836 |
| 2831 /** | 2837 /** |
| 2832 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam
ic`. | 2838 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam
ic`. |
| 2833 */ | 2839 */ |
| 2834 class DynamicTypeImpl extends TypeImpl { | 2840 class DynamicTypeImpl extends TypeImpl { |
| 2835 /** | 2841 /** |
| 2836 * The unique instance of this class. | 2842 * The unique instance of this class. |
| 2837 */ | 2843 */ |
| 2838 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl(); | 2844 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl._(); |
| 2839 | 2845 |
| 2840 /** | 2846 /** |
| 2841 * Return the unique instance of this class. | 2847 * Return the unique instance of this class. |
| 2842 * | 2848 * |
| 2843 * @return the unique instance of this class | 2849 * @return the unique instance of this class |
| 2844 */ | 2850 */ |
| 2845 static DynamicTypeImpl get instance => _INSTANCE; | 2851 static DynamicTypeImpl get instance => _INSTANCE; |
| 2846 | 2852 |
| 2847 /** | 2853 /** |
| 2848 * Prevent the creation of instances of this class. | 2854 * Prevent the creation of instances of this class. |
| 2849 */ | 2855 */ |
| 2850 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { | 2856 DynamicTypeImpl._() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax)
{ |
| 2851 (element as DynamicElementImpl).type = this; | 2857 (element as DynamicElementImpl).type = this; |
| 2852 } | 2858 } |
| 2853 | 2859 |
| 2854 @override | 2860 @override |
| 2855 bool operator ==(Object object) => identical(object, this); | 2861 bool operator ==(Object object) => identical(object, this); |
| 2856 | 2862 |
| 2857 @override | 2863 @override |
| 2858 int get hashCode => 1; | 2864 int get hashCode => 1; |
| 2859 | 2865 |
| 2860 @override | 2866 @override |
| (...skipping 4416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7277 return (element == otherType.element) && TypeImpl.equalArrays(typeArguments,
otherType.typeArguments, visitedElementPairs); | 7283 return (element == otherType.element) && TypeImpl.equalArrays(typeArguments,
otherType.typeArguments, visitedElementPairs); |
| 7278 } | 7284 } |
| 7279 | 7285 |
| 7280 @override | 7286 @override |
| 7281 bool internalIsMoreSpecificThan(DartType type, bool withDynamic, Set<TypeImpl_
TypePair> visitedTypePairs) { | 7287 bool internalIsMoreSpecificThan(DartType type, bool withDynamic, Set<TypeImpl_
TypePair> visitedTypePairs) { |
| 7282 // | 7288 // |
| 7283 // S is dynamic. | 7289 // S is dynamic. |
| 7284 // The test to determine whether S is dynamic is done here because dynamic i
s not an instance of | 7290 // The test to determine whether S is dynamic is done here because dynamic i
s not an instance of |
| 7285 // InterfaceType. | 7291 // InterfaceType. |
| 7286 // | 7292 // |
| 7287 if (identical(type, DynamicTypeImpl.instance)) { | 7293 if (type.isDynamic) { |
| 7288 return true; | 7294 return true; |
| 7289 } else if (type is UnionType) { | 7295 } else if (type is UnionType) { |
| 7290 return (type as UnionTypeImpl).internalUnionTypeIsLessSpecificThan(this, w
ithDynamic, visitedTypePairs); | 7296 return (type as UnionTypeImpl).internalUnionTypeIsLessSpecificThan(this, w
ithDynamic, visitedTypePairs); |
| 7291 } else if (type is! InterfaceType) { | 7297 } else if (type is! InterfaceType) { |
| 7292 return false; | 7298 return false; |
| 7293 } | 7299 } |
| 7294 return _isMoreSpecificThan(type as InterfaceType, new HashSet<ClassElement>(
), withDynamic, visitedTypePairs); | 7300 return _isMoreSpecificThan(type as InterfaceType, new HashSet<ClassElement>(
), withDynamic, visitedTypePairs); |
| 7295 } | 7301 } |
| 7296 | 7302 |
| 7297 @override | 7303 @override |
| (...skipping 3553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10851 } | 10857 } |
| 10852 bool result = internalIsSubtypeOf(type, visitedTypePairs); | 10858 bool result = internalIsSubtypeOf(type, visitedTypePairs); |
| 10853 visitedTypePairs.remove(typePair); | 10859 visitedTypePairs.remove(typePair); |
| 10854 return result; | 10860 return result; |
| 10855 } | 10861 } |
| 10856 | 10862 |
| 10857 @override | 10863 @override |
| 10858 bool isSupertypeOf(DartType type) => type.isSubtypeOf(this); | 10864 bool isSupertypeOf(DartType type) => type.isSubtypeOf(this); |
| 10859 | 10865 |
| 10860 @override | 10866 @override |
| 10867 bool get isUndefined => false; |
| 10868 |
| 10869 @override |
| 10861 bool get isVoid => false; | 10870 bool get isVoid => false; |
| 10862 | 10871 |
| 10863 @override | 10872 @override |
| 10864 String toString() { | 10873 String toString() { |
| 10865 JavaStringBuilder builder = new JavaStringBuilder(); | 10874 JavaStringBuilder builder = new JavaStringBuilder(); |
| 10866 appendTo(builder); | 10875 appendTo(builder); |
| 10867 return builder.toString(); | 10876 return builder.toString(); |
| 10868 } | 10877 } |
| 10869 | 10878 |
| 10870 /** | 10879 /** |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11131 /** | 11140 /** |
| 11132 * The interface `UndefinedElement` defines the behavior of pseudo-elements that
represent | 11141 * The interface `UndefinedElement` defines the behavior of pseudo-elements that
represent |
| 11133 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing | 11142 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing |
| 11134 * this interface always represent an error. As a result, most of the normal ope
rations on elements | 11143 * this interface always represent an error. As a result, most of the normal ope
rations on elements |
| 11135 * do not make sense and will return useless results. | 11144 * do not make sense and will return useless results. |
| 11136 */ | 11145 */ |
| 11137 abstract class UndefinedElement implements Element { | 11146 abstract class UndefinedElement implements Element { |
| 11138 } | 11147 } |
| 11139 | 11148 |
| 11140 /** | 11149 /** |
| 11150 * The unique instance of the class `UndefinedTypeImpl` implements the type of |
| 11151 * typenames that couldn't be resolved. |
| 11152 * |
| 11153 * This class behaves like DynamicTypeImpl in almost every respect, to reduce |
| 11154 * cascading errors. |
| 11155 */ |
| 11156 class UndefinedTypeImpl extends TypeImpl { |
| 11157 /** |
| 11158 * The unique instance of this class. |
| 11159 */ |
| 11160 static UndefinedTypeImpl _INSTANCE = new UndefinedTypeImpl._(); |
| 11161 |
| 11162 /** |
| 11163 * Return the unique instance of this class. |
| 11164 * |
| 11165 * @return the unique instance of this class |
| 11166 */ |
| 11167 static UndefinedTypeImpl get instance => _INSTANCE; |
| 11168 |
| 11169 /** |
| 11170 * Prevent the creation of instances of this class. |
| 11171 */ |
| 11172 UndefinedTypeImpl._() |
| 11173 : super(DynamicElementImpl.instance, Keyword.DYNAMIC.syntax); |
| 11174 |
| 11175 @override |
| 11176 bool operator ==(Object object) => identical(object, this); |
| 11177 |
| 11178 @override |
| 11179 int get hashCode => 1; |
| 11180 |
| 11181 @override |
| 11182 bool get isDynamic => true; |
| 11183 |
| 11184 @override |
| 11185 bool isSupertypeOf(DartType type) => true; |
| 11186 |
| 11187 @override |
| 11188 bool get isUndefined => true; |
| 11189 |
| 11190 @override |
| 11191 DartType substitute2(List<DartType> argumentTypes, List<DartType> parameterTyp
es) { |
| 11192 int length = parameterTypes.length; |
| 11193 for (int i = 0; i < length; i++) { |
| 11194 if (parameterTypes[i] == this) { |
| 11195 return argumentTypes[i]; |
| 11196 } |
| 11197 } |
| 11198 return this; |
| 11199 } |
| 11200 |
| 11201 @override |
| 11202 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id
entical(object, this); |
| 11203 |
| 11204 @override |
| 11205 bool internalIsMoreSpecificThan(DartType type, bool withDynamic, Set<TypeImpl_
TypePair> visitedTypePairs) { |
| 11206 // T is S |
| 11207 if (identical(this, type)) { |
| 11208 return true; |
| 11209 } |
| 11210 // else |
| 11211 return withDynamic; |
| 11212 } |
| 11213 |
| 11214 @override |
| 11215 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair
s) => true; |
| 11216 } |
| 11217 |
| 11218 /** |
| 11141 * A flat immutable union of `Type`s. Here "flat" means a union type never conta
ins another | 11219 * A flat immutable union of `Type`s. Here "flat" means a union type never conta
ins another |
| 11142 * union type. | 11220 * union type. |
| 11143 */ | 11221 */ |
| 11144 abstract class UnionType implements DartType { | 11222 abstract class UnionType implements DartType { |
| 11145 /** | 11223 /** |
| 11146 * @return an immutable view of the types in this union type. | 11224 * @return an immutable view of the types in this union type. |
| 11147 */ | 11225 */ |
| 11148 Set<DartType> get elements; | 11226 Set<DartType> get elements; |
| 11149 } | 11227 } |
| 11150 | 11228 |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11681 | 11759 |
| 11682 @override | 11760 @override |
| 11683 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair
s) { | 11761 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair
s) { |
| 11684 if (type is UnionType) { | 11762 if (type is UnionType) { |
| 11685 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite
dTypePairs); | 11763 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite
dTypePairs); |
| 11686 } | 11764 } |
| 11687 // The only subtype relations that pertain to void are therefore: | 11765 // The only subtype relations that pertain to void are therefore: |
| 11688 // void <: void (by reflexivity) | 11766 // void <: void (by reflexivity) |
| 11689 // bottom <: void (as bottom is a subtype of all types). | 11767 // bottom <: void (as bottom is a subtype of all types). |
| 11690 // void <: dynamic (as dynamic is a supertype of all types) | 11768 // void <: dynamic (as dynamic is a supertype of all types) |
| 11691 return identical(type, this) || identical(type, DynamicTypeImpl.instance); | 11769 return identical(type, this) || type.isDynamic; |
| 11692 } | 11770 } |
| 11693 } | 11771 } |
| OLD | NEW |