@@ -581,9 +581,25 @@ class Typedef extends NamedNode implements FileUriNode {
581581 final List <TypeParameter > typeParameters;
582582 DartType type;
583583
584+ // The following two fields describe parameters of the underlying function
585+ // type. They are needed to keep such attributes as names and annotations.
586+ final List <TypeParameter > typeParametersOfFunctionType;
587+ final List <VariableDeclaration > positionalParameters;
588+ final List <VariableDeclaration > namedParameters;
589+
584590 Typedef (this .name, this .type,
585- {Reference reference, this .fileUri, List <TypeParameter > typeParameters})
591+ {Reference reference,
592+ this .fileUri,
593+ List <TypeParameter > typeParameters,
594+ List <TypeParameter > typeParametersOfFunctionType,
595+ List <VariableDeclaration > positionalParameters,
596+ List <VariableDeclaration > namedParameters})
586597 : this .typeParameters = typeParameters ?? < TypeParameter > [],
598+ this .typeParametersOfFunctionType =
599+ typeParametersOfFunctionType ?? < TypeParameter > [],
600+ this .positionalParameters =
601+ positionalParameters ?? < VariableDeclaration > [],
602+ this .namedParameters = namedParameters ?? < VariableDeclaration > [],
587603 super (reference) {
588604 setParents (this .typeParameters, this );
589605 }
@@ -2224,8 +2240,7 @@ class PropertyGet extends Expression {
22242240 if (interfaceTarget != null ) {
22252241 Class superclass = interfaceTarget.enclosingClass;
22262242 var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2227- return Substitution
2228- .fromInterfaceType (receiverType)
2243+ return Substitution .fromInterfaceType (receiverType)
22292244 .substituteType (interfaceTarget.getterType);
22302245 }
22312246 // Treat the properties of Object specially.
@@ -2342,8 +2357,7 @@ class DirectPropertyGet extends Expression {
23422357 DartType getStaticType (TypeEnvironment types) {
23432358 Class superclass = target.enclosingClass;
23442359 var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2345- return Substitution
2346- .fromInterfaceType (receiverType)
2360+ return Substitution .fromInterfaceType (receiverType)
23472361 .substituteType (target.getterType);
23482362 }
23492363}
@@ -2446,11 +2460,10 @@ class DirectMethodInvocation extends InvocationExpression {
24462460 }
24472461 Class superclass = target.enclosingClass;
24482462 var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2449- var returnType = Substitution
2450- .fromInterfaceType (receiverType)
2463+ var returnType = Substitution .fromInterfaceType (receiverType)
24512464 .substituteType (target.function.returnType);
2452- return Substitution
2453- . fromPairs ( target.function.typeParameters, arguments.types)
2465+ return Substitution . fromPairs (
2466+ target.function.typeParameters, arguments.types)
24542467 .substituteType (returnType);
24552468 }
24562469}
@@ -2481,8 +2494,7 @@ class SuperPropertyGet extends Expression {
24812494 }
24822495 var receiver =
24832496 types.hierarchy.getTypeAsInstanceOf (types.thisType, declaringClass);
2484- return Substitution
2485- .fromInterfaceType (receiver)
2497+ return Substitution .fromInterfaceType (receiver)
24862498 .substituteType (interfaceTarget.getterType);
24872499 }
24882500
@@ -2727,12 +2739,11 @@ class MethodInvocation extends InvocationExpression {
27272739 }
27282740 Class superclass = interfaceTarget.enclosingClass;
27292741 var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2730- var getterType = Substitution
2731- .fromInterfaceType (receiverType)
2742+ var getterType = Substitution .fromInterfaceType (receiverType)
27322743 .substituteType (interfaceTarget.getterType);
27332744 if (getterType is FunctionType ) {
2734- return Substitution
2735- . fromPairs ( getterType.typeParameters, arguments.types)
2745+ return Substitution . fromPairs (
2746+ getterType.typeParameters, arguments.types)
27362747 .substituteType (getterType.returnType);
27372748 } else {
27382749 return const DynamicType ();
@@ -2744,8 +2755,8 @@ class MethodInvocation extends InvocationExpression {
27442755 if (receiverType.typeParameters.length != arguments.types.length) {
27452756 return const BottomType ();
27462757 }
2747- return Substitution
2748- . fromPairs ( receiverType.typeParameters, arguments.types)
2758+ return Substitution . fromPairs (
2759+ receiverType.typeParameters, arguments.types)
27492760 .substituteType (receiverType.returnType);
27502761 }
27512762 }
@@ -2806,11 +2817,10 @@ class SuperMethodInvocation extends InvocationExpression {
28062817 Class superclass = interfaceTarget.enclosingClass;
28072818 var receiverType =
28082819 types.hierarchy.getTypeAsInstanceOf (types.thisType, superclass);
2809- var returnType = Substitution
2810- .fromInterfaceType (receiverType)
2820+ var returnType = Substitution .fromInterfaceType (receiverType)
28112821 .substituteType (interfaceTarget.function.returnType);
2812- return Substitution
2813- . fromPairs ( interfaceTarget.function.typeParameters, arguments.types)
2822+ return Substitution . fromPairs (
2823+ interfaceTarget.function.typeParameters, arguments.types)
28142824 .substituteType (returnType);
28152825 }
28162826
@@ -2859,8 +2869,8 @@ class StaticInvocation extends InvocationExpression {
28592869 }
28602870
28612871 DartType getStaticType (TypeEnvironment types) {
2862- return Substitution
2863- . fromPairs ( target.function.typeParameters, arguments.types)
2872+ return Substitution . fromPairs (
2873+ target.function.typeParameters, arguments.types)
28642874 .substituteType (target.function.returnType);
28652875 }
28662876
@@ -2951,8 +2961,7 @@ class Instantiation extends Expression {
29512961
29522962 DartType getStaticType (TypeEnvironment types) {
29532963 FunctionType type = expression.getStaticType (types);
2954- return Substitution
2955- .fromPairs (type.typeParameters, typeArguments)
2964+ return Substitution .fromPairs (type.typeParameters, typeArguments)
29562965 .substituteType (type.withoutTypeParameters);
29572966 }
29582967
@@ -4804,11 +4813,6 @@ class FunctionType extends DartType {
48044813 final List <DartType > positionalParameters;
48054814 final List <NamedType > namedParameters; // Must be sorted.
48064815
4807- /// The optional names of [positionalParameters] , not `null` , but might be
4808- /// empty if information is not available.
4809- @informative
4810- final List <String > positionalParameterNames;
4811-
48124816 /// The [Typedef] this function type is created for.
48134817 @nocoq
48144818 Reference typedefReference;
@@ -4820,7 +4824,6 @@ class FunctionType extends DartType {
48204824 {this .namedParameters: const < NamedType > [],
48214825 this .typeParameters: const < TypeParameter > [],
48224826 int requiredParameterCount,
4823- this .positionalParameterNames: const < String > [],
48244827 this .typedefReference})
48254828 : this .positionalParameters = positionalParameters,
48264829 this .requiredParameterCount =
0 commit comments