| 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 3a674d4b9ee65283fdfd409d719c0d526047304c..7a348354efa021830680e19a9b621fbdec2b476a 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(typeRef, this);
|
| + DartType type = enclosingElement.resolveTypeRef(this, typeRef);
|
| if (type is InterfaceType && !type.element.isEnum) {
|
| return type;
|
| }
|
| @@ -1000,11 +1000,10 @@ abstract class CompilationUnitElementForLink
|
|
|
| /**
|
| * Compute the type referred to by the given linked type [slot] (interpreted
|
| - * relative to [typeParameterContext]). If there is no inferred type in the
|
| + * in [context]). If there is no inferred type in the
|
| * given slot, `dynamic` is returned.
|
| */
|
| - DartType getLinkedType(
|
| - int slot, TypeParameterizedElementMixin typeParameterContext);
|
| + DartType getLinkedType(ElementImpl context, int slot);
|
|
|
| @override
|
| noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
| @@ -1076,8 +1075,7 @@ abstract class CompilationUnitElementForLink
|
| }
|
|
|
| @override
|
| - DartType resolveTypeRef(
|
| - EntityRef type, TypeParameterizedElementMixin typeParameterContext,
|
| + DartType resolveTypeRef(ElementImpl context, EntityRef type,
|
| {bool defaultVoid: false,
|
| bool instantiateToBoundsAllowed: true,
|
| bool declaredType: false}) {
|
| @@ -1089,7 +1087,8 @@ abstract class CompilationUnitElementForLink
|
| }
|
| }
|
| if (type.paramReference != 0) {
|
| - return typeParameterContext.getTypeParameterType(type.paramReference);
|
| + return context.typeParameterContext
|
| + .getTypeParameterType(type.paramReference);
|
| } else if (type.syntheticReturnType != null) {
|
| // TODO(paulberry): implement.
|
| throw new UnimplementedError();
|
| @@ -1099,7 +1098,7 @@ abstract class CompilationUnitElementForLink
|
| } else {
|
| DartType getTypeArgument(int i) {
|
| if (i < type.typeArguments.length) {
|
| - return resolveTypeRef(type.typeArguments[i], typeParameterContext);
|
| + return resolveTypeRef(context, type.typeArguments[i]);
|
| } else if (!instantiateToBoundsAllowed) {
|
| // Do not allow buildType to instantiate the bounds; force dynamic.
|
| return DynamicTypeImpl.instance;
|
| @@ -1279,8 +1278,7 @@ class CompilationUnitElementInBuildUnit extends CompilationUnitElementForLink {
|
| }
|
|
|
| @override
|
| - DartType getLinkedType(
|
| - int slot, TypeParameterizedElementMixin typeParameterContext) {
|
| + DartType getLinkedType(ElementImpl context, int slot) {
|
| // This method should only be called on compilation units that come from
|
| // dependencies, never on compilation units that are part of the current
|
| // build unit.
|
| @@ -1406,10 +1404,9 @@ class CompilationUnitElementInDependency extends CompilationUnitElementForLink {
|
| bool get isInBuildUnit => false;
|
|
|
| @override
|
| - DartType getLinkedType(
|
| - int slot, TypeParameterizedElementMixin typeParameterContext) {
|
| + DartType getLinkedType(ElementImpl context, int slot) {
|
| if (slot < _linkedTypeRefs.length) {
|
| - return resolveTypeRef(_linkedTypeRefs[slot], typeParameterContext);
|
| + return resolveTypeRef(context, _linkedTypeRefs[slot]);
|
| } else {
|
| return DynamicTypeImpl.instance;
|
| }
|
| @@ -1832,7 +1829,7 @@ abstract class ExecutableElementForLink extends Object
|
| return null;
|
| } else {
|
| return _declaredReturnType ??=
|
| - compilationUnit.resolveTypeRef(_unlinkedExecutable.returnType, this);
|
| + compilationUnit.resolveTypeRef(this, _unlinkedExecutable.returnType);
|
| }
|
| }
|
|
|
| @@ -1879,7 +1876,7 @@ abstract class ExecutableElementForLink extends Object
|
| _inferredReturnType = _computeDefaultReturnType();
|
| } else {
|
| _inferredReturnType = compilationUnit.getLinkedType(
|
| - _unlinkedExecutable.inferredReturnTypeSlot, this);
|
| + this, _unlinkedExecutable.inferredReturnTypeSlot);
|
| }
|
| }
|
| return _inferredReturnType;
|
| @@ -2327,8 +2324,7 @@ class ExprTypeComputer {
|
| if (ref.typeArguments.isNotEmpty) {
|
| return constructorElement.enclosingClass.buildType((int i) {
|
| if (i < ref.typeArguments.length) {
|
| - return unit.resolveTypeRef(
|
| - ref.typeArguments[i], function.typeParameterContext);
|
| + return unit.resolveTypeRef(function, ref.typeArguments[i]);
|
| } else {
|
| return null;
|
| }
|
| @@ -2528,7 +2524,7 @@ class ExprTypeComputer {
|
|
|
| DartType _getNextTypeRef() {
|
| EntityRef ref = _getNextRef();
|
| - return unit.resolveTypeRef(ref, function.typeParameterContext);
|
| + return unit.resolveTypeRef(function, ref);
|
| }
|
|
|
| List<DartType> _getTypeArguments() {
|
| @@ -2885,7 +2881,7 @@ class FunctionElementForLink_FunctionTypedParam extends Object
|
| _returnType = DynamicTypeImpl.instance;
|
| } else {
|
| _returnType = enclosingElement.compilationUnit.resolveTypeRef(
|
| - enclosingElement._unlinkedParam.type, typeParameterContext);
|
| + enclosingElement, enclosingElement._unlinkedParam.type);
|
| }
|
| }
|
| return _returnType;
|
| @@ -3200,7 +3196,7 @@ class FunctionTypeAliasElementForLink extends Object
|
|
|
| @override
|
| DartType get returnType => _returnType ??=
|
| - enclosingElement.resolveTypeRef(_unlinkedTypedef.returnType, this);
|
| + enclosingElement.resolveTypeRef(this, _unlinkedTypedef.returnType);
|
|
|
| @override
|
| TypeParameterizedElementMixin get typeParameterContext => this;
|
| @@ -4193,14 +4189,14 @@ class ParameterElementForLink implements ParameterElementImpl {
|
| } else if (_unlinkedParam.type == null) {
|
| if (!compilationUnit.isInBuildUnit) {
|
| _inferredType = compilationUnit.getLinkedType(
|
| - _unlinkedParam.inferredTypeSlot, _typeParameterContext);
|
| + this, _unlinkedParam.inferredTypeSlot);
|
| return _inferredType;
|
| } else {
|
| _declaredType = DynamicTypeImpl.instance;
|
| }
|
| } else {
|
| - _declaredType = compilationUnit.resolveTypeRef(
|
| - _unlinkedParam.type, _typeParameterContext);
|
| + _declaredType =
|
| + compilationUnit.resolveTypeRef(this, _unlinkedParam.type);
|
| }
|
| }
|
| return _declaredType;
|
| @@ -4212,6 +4208,11 @@ class ParameterElementForLink implements ParameterElementImpl {
|
| _inferredType = inferredType;
|
| }
|
|
|
| + @override
|
| + TypeParameterizedElementMixin get typeParameterContext {
|
| + return _typeParameterContext;
|
| + }
|
| +
|
| /**
|
| * Store the results of type inference for this parameter in
|
| * [compilationUnit].
|
| @@ -5186,8 +5187,8 @@ abstract class VariableElementForLink
|
| if (unlinkedVariable.type == null) {
|
| return null;
|
| } else {
|
| - return _declaredType ??= compilationUnit.resolveTypeRef(
|
| - unlinkedVariable.type, _typeParameterContext);
|
| + return _declaredType ??=
|
| + compilationUnit.resolveTypeRef(this, unlinkedVariable.type);
|
| }
|
| }
|
|
|
| @@ -5226,7 +5227,7 @@ abstract class VariableElementForLink
|
| _inferredType = DynamicTypeImpl.instance;
|
| } else {
|
| _inferredType = compilationUnit.getLinkedType(
|
| - unlinkedVariable.inferredTypeSlot, _typeParameterContext);
|
| + this, unlinkedVariable.inferredTypeSlot);
|
| }
|
| }
|
| return _inferredType;
|
| @@ -5285,6 +5286,11 @@ 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.
|
|
|