Index: pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart |
index 185e1d5d84c590684544cbb13d11698cb2d9566a..347b08488602aa4c7a6d0b70cbe950d7d90611d9 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart |
@@ -64,44 +64,37 @@ abstract class KernelClassBuilder |
/// [arguments] have already been built. |
InterfaceType buildTypesWithBuiltArguments( |
LibraryBuilder library, List<DartType> arguments) { |
- return arguments == null |
- ? cls.rawType |
- : new InterfaceType( |
- cls, |
- // TODO(ahe): Not sure what to do if `arguments.length != |
- // cls.typeParameters.length`. |
- computeDefaultTypeArguments(cls.typeParameters, arguments)); |
+ assert(arguments == null || cls.typeParameters.length == arguments.length); |
+ return arguments == null ? cls.rawType : new InterfaceType(cls, arguments); |
+ } |
+ |
+ List<DartType> buildTypeArguments( |
+ LibraryBuilder library, List<KernelTypeBuilder> arguments) { |
+ List<DartType> typeArguments = <DartType>[]; |
+ for (KernelTypeBuilder builder in arguments) { |
+ DartType type = builder.build(library); |
+ if (type == null) { |
+ internalError("Bad type: ${builder.runtimeType}"); |
+ } |
+ typeArguments.add(type); |
+ } |
+ return computeDefaultTypeArguments( |
+ library, cls.typeParameters, typeArguments); |
} |
InterfaceType buildType( |
LibraryBuilder library, List<KernelTypeBuilder> arguments) { |
List<DartType> typeArguments; |
if (arguments != null) { |
- typeArguments = <DartType>[]; |
- for (KernelTypeBuilder builder in arguments) { |
- DartType type = builder.build(library); |
- if (type == null) { |
- internalError("Bad type: ${builder.runtimeType}"); |
- } |
- typeArguments.add(type); |
- } |
+ typeArguments = buildTypeArguments(library, arguments); |
} |
return buildTypesWithBuiltArguments(library, typeArguments); |
} |
Supertype buildSupertype( |
LibraryBuilder library, List<KernelTypeBuilder> arguments) { |
- List<DartType> typeArguments; |
if (arguments != null) { |
- typeArguments = <DartType>[]; |
- for (KernelTypeBuilder builder in arguments) { |
- DartType type = builder.build(library); |
- if (type == null) { |
- internalError("Bad type: ${builder.runtimeType}"); |
- } |
- typeArguments.add(type); |
- } |
- return new Supertype(cls, typeArguments); |
+ return new Supertype(cls, buildTypeArguments(library, arguments)); |
} else { |
return cls.asRawSupertype; |
} |