| Index: pkg/analyzer/lib/src/summary/link.dart
|
| diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
|
| index b7f77030f2762b4cb345d85ba1c8401e77a2b419..3a674d4b9ee65283fdfd409d719c0d526047304c 100644
|
| --- a/pkg/analyzer/lib/src/summary/link.dart
|
| +++ b/pkg/analyzer/lib/src/summary/link.dart
|
| @@ -683,7 +683,7 @@ class ClassElementForLink_Class extends ClassElementForLink
|
| */
|
| InterfaceType _computeInterfaceType(EntityRef typeRef) {
|
| if (typeRef != null) {
|
| - DartType type = enclosingElement.resolveTypeRef(this, typeRef);
|
| + DartType type = enclosingElement.resolveTypeRef(typeRef, this);
|
| if (type is InterfaceType && !type.element.isEnum) {
|
| return type;
|
| }
|
| @@ -1076,7 +1076,8 @@ abstract class CompilationUnitElementForLink
|
| }
|
|
|
| @override
|
| - DartType resolveTypeRef(ElementImpl context, EntityRef type,
|
| + DartType resolveTypeRef(
|
| + EntityRef type, TypeParameterizedElementMixin typeParameterContext,
|
| {bool defaultVoid: false,
|
| bool instantiateToBoundsAllowed: true,
|
| bool declaredType: false}) {
|
| @@ -1088,8 +1089,7 @@ abstract class CompilationUnitElementForLink
|
| }
|
| }
|
| if (type.paramReference != 0) {
|
| - return context.typeParameterContext
|
| - .getTypeParameterType(type.paramReference);
|
| + return typeParameterContext.getTypeParameterType(type.paramReference);
|
| } else if (type.syntheticReturnType != null) {
|
| // TODO(paulberry): implement.
|
| throw new UnimplementedError();
|
| @@ -1099,7 +1099,7 @@ abstract class CompilationUnitElementForLink
|
| } else {
|
| DartType getTypeArgument(int i) {
|
| if (i < type.typeArguments.length) {
|
| - return resolveTypeRef(context, type.typeArguments[i]);
|
| + return resolveTypeRef(type.typeArguments[i], typeParameterContext);
|
| } else if (!instantiateToBoundsAllowed) {
|
| // Do not allow buildType to instantiate the bounds; force dynamic.
|
| return DynamicTypeImpl.instance;
|
| @@ -1409,7 +1409,7 @@ class CompilationUnitElementInDependency extends CompilationUnitElementForLink {
|
| DartType getLinkedType(
|
| int slot, TypeParameterizedElementMixin typeParameterContext) {
|
| if (slot < _linkedTypeRefs.length) {
|
| - return resolveTypeRef(this, _linkedTypeRefs[slot]);
|
| + return resolveTypeRef(_linkedTypeRefs[slot], typeParameterContext);
|
| } else {
|
| return DynamicTypeImpl.instance;
|
| }
|
| @@ -1832,7 +1832,7 @@ abstract class ExecutableElementForLink extends Object
|
| return null;
|
| } else {
|
| return _declaredReturnType ??=
|
| - compilationUnit.resolveTypeRef(this, _unlinkedExecutable.returnType);
|
| + compilationUnit.resolveTypeRef(_unlinkedExecutable.returnType, this);
|
| }
|
| }
|
|
|
| @@ -2327,7 +2327,8 @@ class ExprTypeComputer {
|
| if (ref.typeArguments.isNotEmpty) {
|
| return constructorElement.enclosingClass.buildType((int i) {
|
| if (i < ref.typeArguments.length) {
|
| - return unit.resolveTypeRef(function, ref.typeArguments[i]);
|
| + return unit.resolveTypeRef(
|
| + ref.typeArguments[i], function.typeParameterContext);
|
| } else {
|
| return null;
|
| }
|
| @@ -2527,7 +2528,7 @@ class ExprTypeComputer {
|
|
|
| DartType _getNextTypeRef() {
|
| EntityRef ref = _getNextRef();
|
| - return unit.resolveTypeRef(function, ref);
|
| + return unit.resolveTypeRef(ref, function.typeParameterContext);
|
| }
|
|
|
| List<DartType> _getTypeArguments() {
|
| @@ -2884,7 +2885,7 @@ class FunctionElementForLink_FunctionTypedParam extends Object
|
| _returnType = DynamicTypeImpl.instance;
|
| } else {
|
| _returnType = enclosingElement.compilationUnit.resolveTypeRef(
|
| - enclosingElement, enclosingElement._unlinkedParam.type);
|
| + enclosingElement._unlinkedParam.type, typeParameterContext);
|
| }
|
| }
|
| return _returnType;
|
| @@ -3199,7 +3200,7 @@ class FunctionTypeAliasElementForLink extends Object
|
|
|
| @override
|
| DartType get returnType => _returnType ??=
|
| - enclosingElement.resolveTypeRef(this, _unlinkedTypedef.returnType);
|
| + enclosingElement.resolveTypeRef(_unlinkedTypedef.returnType, this);
|
|
|
| @override
|
| TypeParameterizedElementMixin get typeParameterContext => this;
|
| @@ -4198,8 +4199,8 @@ class ParameterElementForLink implements ParameterElementImpl {
|
| _declaredType = DynamicTypeImpl.instance;
|
| }
|
| } else {
|
| - _declaredType =
|
| - compilationUnit.resolveTypeRef(this, _unlinkedParam.type);
|
| + _declaredType = compilationUnit.resolveTypeRef(
|
| + _unlinkedParam.type, _typeParameterContext);
|
| }
|
| }
|
| return _declaredType;
|
| @@ -4211,11 +4212,6 @@ class ParameterElementForLink implements ParameterElementImpl {
|
| _inferredType = inferredType;
|
| }
|
|
|
| - @override
|
| - TypeParameterizedElementMixin get typeParameterContext {
|
| - return _typeParameterContext;
|
| - }
|
| -
|
| /**
|
| * Store the results of type inference for this parameter in
|
| * [compilationUnit].
|
| @@ -5190,8 +5186,8 @@ abstract class VariableElementForLink
|
| if (unlinkedVariable.type == null) {
|
| return null;
|
| } else {
|
| - return _declaredType ??=
|
| - compilationUnit.resolveTypeRef(this, unlinkedVariable.type);
|
| + return _declaredType ??= compilationUnit.resolveTypeRef(
|
| + unlinkedVariable.type, _typeParameterContext);
|
| }
|
| }
|
|
|
| @@ -5289,11 +5285,6 @@ abstract class VariableElementForLink
|
| // TODO(paulberry): store inferred type.
|
| }
|
|
|
| - @override
|
| - TypeParameterizedElementMixin get typeParameterContext {
|
| - return _typeParameterContext;
|
| - }
|
| -
|
| /**
|
| * The context in which type parameters should be interpreted, or `null` if
|
| * there are no type parameters in scope.
|
|
|