Index: pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart |
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart |
index 40b8d06b447b869da141a74b6aa12f1267a59927..f60d79321322355d24cb394e5781d65077232c0d 100644 |
--- a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart |
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart |
@@ -30,6 +30,22 @@ FunctionType substituteTypeParams( |
requiredParameterCount: type.requiredParameterCount); |
} |
+/// Given a [FunctionType], gets the type of the named parameter with the given |
+/// [name], or `dynamic` if there is no parameter with the given name. |
+DartType getNamedParameterType(FunctionType functionType, String name) { |
+ return functionType.getNamedParameter(name) ?? const DynamicType(); |
+} |
+ |
+/// Given a [FunctionType], gets the type of the [i]th positional parameter, or |
+/// `dynamic` if there is no parameter with that index. |
+DartType getPositionalParameterType(FunctionType functionType, int i) { |
+ if (i < functionType.positionalParameters.length) { |
+ return functionType.positionalParameters[i]; |
+ } else { |
+ return const DynamicType(); |
+ } |
+} |
+ |
/// A constraint on a type parameter that we're inferring. |
class TypeConstraint { |
/// The lower bound of the type being constrained. This bound must be a |