Chromium Code Reviews| 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 4336d919eaca55405599ca5ea3f1f6d53c9cc72e..40b8d06b447b869da141a74b6aa12f1267a59927 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 |
| @@ -13,6 +13,23 @@ import 'package:kernel/core_types.dart'; |
| import 'package:kernel/type_algebra.dart'; |
| import 'package:kernel/type_environment.dart'; |
| +// TODO(paulberry): try to push this functionality into kernel. |
| +FunctionType substituteTypeParams( |
| + FunctionType type, |
| + Map<TypeParameter, DartType> substitutionMap, |
| + List<TypeParameter> newTypeParameters) { |
| + var substitution = Substitution.fromMap(substitutionMap); |
| + return new FunctionType( |
| + type.positionalParameters.map(substitution.substituteType).toList(), |
| + substitution.substituteType(type.returnType), |
| + namedParameters: type.namedParameters |
| + .map((named) => new NamedType( |
| + named.name, substitution.substituteType(named.type))) |
| + .toList(), |
| + typeParameters: newTypeParameters, |
|
Siggi Cherem (dart-lang)
2017/06/21 20:19:08
Just making sure I follow the change here. Before
Paul Berry
2017/06/21 20:54:47
That's right. It was a bug which happened to be b
|
| + requiredParameterCount: type.requiredParameterCount); |
| +} |
| + |
| /// 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 |