Index: dart/pkg/analyzer/lib/src/generated/element.dart |
=================================================================== |
--- dart/pkg/analyzer/lib/src/generated/element.dart (revision 29785) |
+++ dart/pkg/analyzer/lib/src/generated/element.dart (working copy) |
@@ -4312,9 +4312,14 @@ |
/** |
* Is `true` if this variable is potentially mutated somewhere in its scope. |
*/ |
- bool _isPotentiallyMutated2 = false; |
+ bool _isPotentiallyMutatedInScope2 = false; |
/** |
+ * Is `true` if this variable is potentially mutated somewhere in closure. |
+ */ |
+ bool _isPotentiallyMutatedInClosure2 = false; |
+ |
+ /** |
* The offset to the beginning of the visible range for this element. |
*/ |
int _visibleRangeOffset = 0; |
@@ -4344,13 +4349,21 @@ |
} |
return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
} |
- bool get isPotentiallyMutated => _isPotentiallyMutated2; |
+ bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure2; |
+ bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope2; |
/** |
+ * Specifies that this variable is potentially mutated somewhere in closure. |
+ */ |
+ void markPotentiallyMutatedInClosure() { |
+ _isPotentiallyMutatedInClosure2 = true; |
+ } |
+ |
+ /** |
* Specifies that this variable is potentially mutated somewhere in its scope. |
*/ |
- void markPotentiallyMutated() { |
- _isPotentiallyMutated2 = true; |
+ void markPotentiallyMutatedInScope() { |
+ _isPotentiallyMutatedInScope2 = true; |
} |
/** |
@@ -4613,9 +4626,14 @@ |
/** |
* Is `true` if this variable is potentially mutated somewhere in its scope. |
*/ |
- bool _isPotentiallyMutated3 = false; |
+ bool _isPotentiallyMutatedInScope3 = false; |
/** |
+ * Is `true` if this variable is potentially mutated somewhere in closure. |
+ */ |
+ bool _isPotentiallyMutatedInClosure3 = false; |
+ |
+ /** |
* An array containing all of the parameters defined by this parameter element. There will only be |
* parameters if this parameter is a function typed parameter. |
*/ |
@@ -4685,13 +4703,21 @@ |
return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
} |
bool get isInitializingFormal => false; |
- bool get isPotentiallyMutated => _isPotentiallyMutated3; |
+ bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure3; |
+ bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope3; |
/** |
+ * Specifies that this variable is potentially mutated somewhere in closure. |
+ */ |
+ void markPotentiallyMutatedInClosure() { |
+ _isPotentiallyMutatedInClosure3 = true; |
+ } |
+ |
+ /** |
* Specifies that this variable is potentially mutated somewhere in its scope. |
*/ |
- void markPotentiallyMutated() { |
- _isPotentiallyMutated3 = true; |
+ void markPotentiallyMutatedInScope() { |
+ _isPotentiallyMutatedInScope3 = true; |
} |
/** |
@@ -5191,12 +5217,20 @@ |
bool get isFinal => hasModifier(Modifier.FINAL); |
/** |
+ * Return `true` if this variable is potentially mutated somewhere in closure. This |
+ * information is only available for local variables (including parameters). |
+ * |
+ * @return `true` if this variable is potentially mutated somewhere in closure |
+ */ |
+ bool get isPotentiallyMutatedInClosure => false; |
+ |
+ /** |
* Return `true` if this variable is potentially mutated somewhere in its scope. This |
* information is only available for local variables (including parameters). |
* |
* @return `true` if this variable is potentially mutated somewhere in its scope |
*/ |
- bool get isPotentiallyMutated => false; |
+ bool get isPotentiallyMutatedInScope => false; |
/** |
* Set whether this variable is const to correspond to the given value. |
@@ -5835,7 +5869,7 @@ |
BottomTypeImpl() : super(null, "<bottom>"); |
bool operator ==(Object object) => identical(object, this); |
bool get isBottom => true; |
- bool isMoreSpecificThan(Type2 type) => true; |
+ bool isMoreSpecificThan3(Type2 type, bool withDynamic) => true; |
bool isSubtypeOf(Type2 type) => true; |
bool isSupertypeOf(Type2 type) => false; |
BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) => this; |
@@ -5860,11 +5894,11 @@ |
} |
bool operator ==(Object object) => object is DynamicTypeImpl; |
bool get isDynamic => true; |
- bool isMoreSpecificThan(Type2 type) { |
+ bool isMoreSpecificThan3(Type2 type, bool withDynamic) { |
if (identical(this, type)) { |
return true; |
} |
- return false; |
+ return withDynamic; |
} |
bool isSubtypeOf(Type2 type) => true; |
bool isSupertypeOf(Type2 type) => true; |
@@ -6086,7 +6120,7 @@ |
return element.hashCode; |
} |
bool isAssignableTo(Type2 type) => this.isSubtypeOf(type); |
- bool isMoreSpecificThan(Type2 type) { |
+ bool isMoreSpecificThan3(Type2 type, bool withDynamic) { |
if (type == null) { |
return false; |
} else if (identical(this, type) || type.isDynamic || type.isDartCoreFunction || type.isObject) { |
@@ -6110,7 +6144,7 @@ |
return false; |
} else if (t.normalParameterTypes.length > 0) { |
for (int i = 0; i < tTypes.length; i++) { |
- if (!tTypes[i].isMoreSpecificThan(sTypes[i])) { |
+ if (!tTypes[i].isMoreSpecificThan3(sTypes[i], withDynamic)) { |
return false; |
} |
} |
@@ -6127,7 +6161,7 @@ |
if (typeT == null) { |
return false; |
} |
- if (!typeT.isMoreSpecificThan(entryS.getValue())) { |
+ if (!typeT.isMoreSpecificThan3(entryS.getValue(), withDynamic)) { |
return false; |
} |
} |
@@ -6141,7 +6175,7 @@ |
} |
if (tOpTypes.length == 0 && sOpTypes.length == 0) { |
for (int i = 0; i < sTypes.length; i++) { |
- if (!tTypes[i].isMoreSpecificThan(sTypes[i])) { |
+ if (!tTypes[i].isMoreSpecificThan3(sTypes[i], withDynamic)) { |
return false; |
} |
} |
@@ -6161,7 +6195,7 @@ |
sAllTypes[i] = sOpTypes[j]; |
} |
for (int i = 0; i < sAllTypes.length; i++) { |
- if (!tAllTypes[i].isMoreSpecificThan(sAllTypes[i])) { |
+ if (!tAllTypes[i].isMoreSpecificThan3(sAllTypes[i], withDynamic)) { |
return false; |
} |
} |
@@ -6169,7 +6203,7 @@ |
} |
Type2 tRetType = t.returnType; |
Type2 sRetType = s.returnType; |
- return sRetType.isVoid || tRetType.isMoreSpecificThan(sRetType); |
+ return sRetType.isVoid || tRetType.isMoreSpecificThan3(sRetType, withDynamic); |
} |
bool isSubtypeOf(Type2 type) { |
if (type == null) { |
@@ -6698,35 +6732,40 @@ |
return element.name == "Function" && element.library.isDartCore; |
} |
bool isDirectSupertypeOf(InterfaceType type) { |
- ClassElement i = element; |
- ClassElement j = type.element; |
- InterfaceType supertype = j.supertype; |
+ InterfaceType i = this; |
+ InterfaceType j = type; |
+ ClassElement jElement = j.element; |
+ InterfaceType supertype = jElement.supertype; |
if (supertype == null) { |
return false; |
} |
- ClassElement supertypeElement = supertype.element; |
- if (supertypeElement == i) { |
+ List<Type2> jArgs = j.typeArguments; |
+ List<Type2> jVars = jElement.type.typeArguments; |
+ supertype = supertype.substitute2(jArgs, jVars); |
+ if (supertype == i) { |
return true; |
} |
- for (InterfaceType interfaceType in j.interfaces) { |
- if (interfaceType.element == i) { |
+ for (InterfaceType interfaceType in jElement.interfaces) { |
+ interfaceType = interfaceType.substitute2(jArgs, jVars); |
+ if (interfaceType == i) { |
return true; |
} |
} |
- for (InterfaceType mixinType in j.mixins) { |
- if (mixinType.element == i) { |
+ for (InterfaceType mixinType in jElement.mixins) { |
+ mixinType = mixinType.substitute2(jArgs, jVars); |
+ if (mixinType == i) { |
return true; |
} |
} |
return false; |
} |
- bool isMoreSpecificThan(Type2 type) { |
+ bool isMoreSpecificThan3(Type2 type, bool withDynamic) { |
if (identical(type, DynamicTypeImpl.instance)) { |
return true; |
} else if (type is! InterfaceType) { |
return false; |
} |
- return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>()); |
+ return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>(), withDynamic); |
} |
bool get isObject => element.supertype == null; |
bool isSubtypeOf(Type2 type) { |
@@ -6901,7 +6940,7 @@ |
builder.append(">"); |
} |
} |
- bool isMoreSpecificThan2(InterfaceType s, Set<ClassElement> visitedClasses) { |
+ bool isMoreSpecificThan2(InterfaceType s, Set<ClassElement> visitedClasses, bool withDynamic) { |
if (this == s) { |
return true; |
} |
@@ -6917,7 +6956,7 @@ |
return false; |
} |
for (int i = 0; i < tArguments.length; i++) { |
- if (!tArguments[i].isMoreSpecificThan(sArguments[i])) { |
+ if (!tArguments[i].isMoreSpecificThan3(sArguments[i], withDynamic)) { |
return false; |
} |
} |
@@ -6929,16 +6968,16 @@ |
} |
javaSetAdd(visitedClasses, element); |
InterfaceType supertype = superclass; |
- if (supertype != null && ((supertype as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses)) { |
+ if (supertype != null && ((supertype as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses, withDynamic)) { |
return true; |
} |
for (InterfaceType interfaceType in interfaces) { |
- if (((interfaceType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses)) { |
+ if (((interfaceType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses, withDynamic)) { |
return true; |
} |
} |
for (InterfaceType mixinType in mixins) { |
- if (((mixinType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses)) { |
+ if (((mixinType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses, withDynamic)) { |
return true; |
} |
} |
@@ -6952,7 +6991,6 @@ |
return false; |
} |
javaSetAdd(visitedClasses, elementT); |
- typeT = substitute2(_typeArguments, elementT.type.typeArguments); |
if (typeT == typeS) { |
return true; |
} else if (elementT == typeS.element) { |
@@ -7052,7 +7090,8 @@ |
bool get isBottom => false; |
bool get isDartCoreFunction => false; |
bool get isDynamic => false; |
- bool isMoreSpecificThan(Type2 type) => false; |
+ bool isMoreSpecificThan(Type2 type) => isMoreSpecificThan3(type, false); |
+ bool isMoreSpecificThan3(Type2 type, bool withDynamic) => false; |
bool get isObject => false; |
bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); |
bool get isVoid => false; |
@@ -7118,7 +7157,7 @@ |
bool operator ==(Object object) => object is TypeParameterTypeImpl && (element == ((object as TypeParameterTypeImpl)).element); |
TypeParameterElement get element => super.element as TypeParameterElement; |
int get hashCode => element.hashCode; |
- bool isMoreSpecificThan(Type2 s) { |
+ bool isMoreSpecificThan3(Type2 s, bool withDynamic) { |
if (this == s) { |
return true; |
} |
@@ -7128,9 +7167,9 @@ |
if (s.isDynamic) { |
return true; |
} |
- return isMoreSpecificThan3(s, new Set<Type2>()); |
+ return isMoreSpecificThan4(s, new Set<Type2>(), withDynamic); |
} |
- bool isSubtypeOf(Type2 s) => isMoreSpecificThan(s); |
+ bool isSubtypeOf(Type2 s) => isMoreSpecificThan3(s, true); |
Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { |
int length = parameterTypes.length; |
for (int i = 0; i < length; i++) { |
@@ -7140,7 +7179,7 @@ |
} |
return this; |
} |
- bool isMoreSpecificThan3(Type2 s, Set<Type2> visitedTypes) { |
+ bool isMoreSpecificThan4(Type2 s, Set<Type2> visitedTypes, bool withDynamic) { |
Type2 bound = element.bound; |
if (s == bound) { |
return true; |
@@ -7157,9 +7196,9 @@ |
return false; |
} |
javaSetAdd(visitedTypes, bound); |
- return boundTypeParameter.isMoreSpecificThan3(s, visitedTypes); |
+ return boundTypeParameter.isMoreSpecificThan4(s, visitedTypes, withDynamic); |
} |
- return bound.isMoreSpecificThan(s); |
+ return bound.isMoreSpecificThan3(s, withDynamic); |
} |
} |
/** |
@@ -7732,6 +7771,15 @@ |
bool isMoreSpecificThan(Type2 type); |
/** |
+ * Return `true` if this type is more specific than the given type. |
+ * |
+ * @param type the type being compared with this type |
+ * @param withDynamic `true` if "dynamic" should be considered as a subtype of any type |
+ * @return `true` if this type is more specific than the given type |
+ */ |
+ bool isMoreSpecificThan3(Type2 type, bool withDynamic); |
+ |
+ /** |
* Return `true` if this type represents the type 'Object'. |
* |
* @return `true` if this type represents the type 'Object' |