@@ -581,9 +581,25 @@ class Typedef extends NamedNode implements FileUriNode {
581
581
final List <TypeParameter > typeParameters;
582
582
DartType type;
583
583
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
+
584
590
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})
586
597
: this .typeParameters = typeParameters ?? < TypeParameter > [],
598
+ this .typeParametersOfFunctionType =
599
+ typeParametersOfFunctionType ?? < TypeParameter > [],
600
+ this .positionalParameters =
601
+ positionalParameters ?? < VariableDeclaration > [],
602
+ this .namedParameters = namedParameters ?? < VariableDeclaration > [],
587
603
super (reference) {
588
604
setParents (this .typeParameters, this );
589
605
}
@@ -2224,8 +2240,7 @@ class PropertyGet extends Expression {
2224
2240
if (interfaceTarget != null ) {
2225
2241
Class superclass = interfaceTarget.enclosingClass;
2226
2242
var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2227
- return Substitution
2228
- .fromInterfaceType (receiverType)
2243
+ return Substitution .fromInterfaceType (receiverType)
2229
2244
.substituteType (interfaceTarget.getterType);
2230
2245
}
2231
2246
// Treat the properties of Object specially.
@@ -2342,8 +2357,7 @@ class DirectPropertyGet extends Expression {
2342
2357
DartType getStaticType (TypeEnvironment types) {
2343
2358
Class superclass = target.enclosingClass;
2344
2359
var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2345
- return Substitution
2346
- .fromInterfaceType (receiverType)
2360
+ return Substitution .fromInterfaceType (receiverType)
2347
2361
.substituteType (target.getterType);
2348
2362
}
2349
2363
}
@@ -2446,11 +2460,10 @@ class DirectMethodInvocation extends InvocationExpression {
2446
2460
}
2447
2461
Class superclass = target.enclosingClass;
2448
2462
var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2449
- var returnType = Substitution
2450
- .fromInterfaceType (receiverType)
2463
+ var returnType = Substitution .fromInterfaceType (receiverType)
2451
2464
.substituteType (target.function.returnType);
2452
- return Substitution
2453
- . fromPairs ( target.function.typeParameters, arguments.types)
2465
+ return Substitution . fromPairs (
2466
+ target.function.typeParameters, arguments.types)
2454
2467
.substituteType (returnType);
2455
2468
}
2456
2469
}
@@ -2481,8 +2494,7 @@ class SuperPropertyGet extends Expression {
2481
2494
}
2482
2495
var receiver =
2483
2496
types.hierarchy.getTypeAsInstanceOf (types.thisType, declaringClass);
2484
- return Substitution
2485
- .fromInterfaceType (receiver)
2497
+ return Substitution .fromInterfaceType (receiver)
2486
2498
.substituteType (interfaceTarget.getterType);
2487
2499
}
2488
2500
@@ -2727,12 +2739,11 @@ class MethodInvocation extends InvocationExpression {
2727
2739
}
2728
2740
Class superclass = interfaceTarget.enclosingClass;
2729
2741
var receiverType = receiver.getStaticTypeAsInstanceOf (superclass, types);
2730
- var getterType = Substitution
2731
- .fromInterfaceType (receiverType)
2742
+ var getterType = Substitution .fromInterfaceType (receiverType)
2732
2743
.substituteType (interfaceTarget.getterType);
2733
2744
if (getterType is FunctionType ) {
2734
- return Substitution
2735
- . fromPairs ( getterType.typeParameters, arguments.types)
2745
+ return Substitution . fromPairs (
2746
+ getterType.typeParameters, arguments.types)
2736
2747
.substituteType (getterType.returnType);
2737
2748
} else {
2738
2749
return const DynamicType ();
@@ -2744,8 +2755,8 @@ class MethodInvocation extends InvocationExpression {
2744
2755
if (receiverType.typeParameters.length != arguments.types.length) {
2745
2756
return const BottomType ();
2746
2757
}
2747
- return Substitution
2748
- . fromPairs ( receiverType.typeParameters, arguments.types)
2758
+ return Substitution . fromPairs (
2759
+ receiverType.typeParameters, arguments.types)
2749
2760
.substituteType (receiverType.returnType);
2750
2761
}
2751
2762
}
@@ -2806,11 +2817,10 @@ class SuperMethodInvocation extends InvocationExpression {
2806
2817
Class superclass = interfaceTarget.enclosingClass;
2807
2818
var receiverType =
2808
2819
types.hierarchy.getTypeAsInstanceOf (types.thisType, superclass);
2809
- var returnType = Substitution
2810
- .fromInterfaceType (receiverType)
2820
+ var returnType = Substitution .fromInterfaceType (receiverType)
2811
2821
.substituteType (interfaceTarget.function.returnType);
2812
- return Substitution
2813
- . fromPairs ( interfaceTarget.function.typeParameters, arguments.types)
2822
+ return Substitution . fromPairs (
2823
+ interfaceTarget.function.typeParameters, arguments.types)
2814
2824
.substituteType (returnType);
2815
2825
}
2816
2826
@@ -2859,8 +2869,8 @@ class StaticInvocation extends InvocationExpression {
2859
2869
}
2860
2870
2861
2871
DartType getStaticType (TypeEnvironment types) {
2862
- return Substitution
2863
- . fromPairs ( target.function.typeParameters, arguments.types)
2872
+ return Substitution . fromPairs (
2873
+ target.function.typeParameters, arguments.types)
2864
2874
.substituteType (target.function.returnType);
2865
2875
}
2866
2876
@@ -2951,8 +2961,7 @@ class Instantiation extends Expression {
2951
2961
2952
2962
DartType getStaticType (TypeEnvironment types) {
2953
2963
FunctionType type = expression.getStaticType (types);
2954
- return Substitution
2955
- .fromPairs (type.typeParameters, typeArguments)
2964
+ return Substitution .fromPairs (type.typeParameters, typeArguments)
2956
2965
.substituteType (type.withoutTypeParameters);
2957
2966
}
2958
2967
@@ -4804,11 +4813,6 @@ class FunctionType extends DartType {
4804
4813
final List <DartType > positionalParameters;
4805
4814
final List <NamedType > namedParameters; // Must be sorted.
4806
4815
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
-
4812
4816
/// The [Typedef] this function type is created for.
4813
4817
@nocoq
4814
4818
Reference typedefReference;
@@ -4820,7 +4824,6 @@ class FunctionType extends DartType {
4820
4824
{this .namedParameters: const < NamedType > [],
4821
4825
this .typeParameters: const < TypeParameter > [],
4822
4826
int requiredParameterCount,
4823
- this .positionalParameterNames: const < String > [],
4824
4827
this .typedefReference})
4825
4828
: this .positionalParameters = positionalParameters,
4826
4829
this .requiredParameterCount =
0 commit comments