Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart

Issue 2876813002: Implement generalized function types. (Closed)
Patch Set: Address comments. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
index fea4cea5f9d707b3087ae33a715d33e3678ce7af..a4f614ff31f2db8fb06e63c43d7a787b10210300 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
@@ -10,26 +10,24 @@ import 'package:kernel/ast.dart'
DynamicType,
FunctionType,
InvalidType,
- NamedType,
TypeParameter,
Typedef;
import 'package:kernel/type_algebra.dart' show substitute;
import '../messages.dart' show warning;
-
import 'kernel_builder.dart'
show
FormalParameterBuilder,
FunctionTypeAliasBuilder,
- KernelFormalParameterBuilder,
KernelTypeBuilder,
- KernelTypeVariableBuilder,
LibraryBuilder,
MetadataBuilder,
TypeVariableBuilder,
computeDefaultTypeArguments;
+import 'kernel_function_type_builder.dart' show buildFunctionType;
+
class KernelFunctionTypeAliasBuilder
extends FunctionTypeAliasBuilder<KernelTypeBuilder, DartType> {
final Typedef target;
@@ -67,37 +65,8 @@ class KernelFunctionTypeAliasBuilder
return thisType;
}
thisType = const InvalidType();
- DartType returnType =
- this.returnType?.build(library) ?? const DynamicType();
- List<DartType> positionalParameters = <DartType>[];
- List<NamedType> namedParameters;
- int requiredParameterCount = 0;
- if (formals != null) {
- for (KernelFormalParameterBuilder formal in formals) {
- DartType type = formal.type?.build(library) ?? const DynamicType();
- if (formal.isPositional) {
- positionalParameters.add(type);
- if (formal.isRequired) requiredParameterCount++;
- } else if (formal.isNamed) {
- namedParameters ??= <NamedType>[];
- namedParameters.add(new NamedType(formal.name, type));
- }
- }
- if (namedParameters != null) {
- namedParameters.sort();
- }
- }
- List<TypeParameter> typeParameters;
- if (typeVariables != null) {
- typeParameters = <TypeParameter>[];
- for (KernelTypeVariableBuilder t in typeVariables) {
- typeParameters.add(t.parameter);
- }
- }
- return thisType = new FunctionType(positionalParameters, returnType,
- namedParameters: namedParameters ?? const <NamedType>[],
- typeParameters: typeParameters ?? const <TypeParameter>[],
- requiredParameterCount: requiredParameterCount);
+ return thisType =
+ buildFunctionType(library, returnType, typeVariables, formals);
}
/// [arguments] have already been built.
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698