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

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

Issue 2985293002: Add optional FunctionType.positionalParameterNames and use them to resynthesize function-type forma… (Closed)
Patch Set: Created 3 years, 5 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_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
index 437379a81070f3e67ff5e84fc436693903e33f56..3dc642ead97073bfafae5385c1f717a8043adb8e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
@@ -41,6 +41,7 @@ class KernelFunctionTypeBuilder extends FunctionTypeBuilder
DartType builtReturnType =
returnType?.build(library) ?? const DynamicType();
List<DartType> positionalParameters = <DartType>[];
+ List<String> positionalParameterNames = <String>[];
List<NamedType> namedParameters;
int requiredParameterCount = 0;
if (formals != null) {
@@ -48,6 +49,7 @@ class KernelFunctionTypeBuilder extends FunctionTypeBuilder
DartType type = formal.type?.build(library) ?? const DynamicType();
if (formal.isPositional) {
positionalParameters.add(type);
+ positionalParameterNames.add(formal.name ?? '');
if (formal.isRequired) requiredParameterCount++;
} else if (formal.isNamed) {
namedParameters ??= <NamedType>[];
@@ -68,7 +70,8 @@ class KernelFunctionTypeBuilder extends FunctionTypeBuilder
return new FunctionType(positionalParameters, builtReturnType,
namedParameters: namedParameters ?? const <NamedType>[],
typeParameters: typeParameters ?? const <TypeParameter>[],
- requiredParameterCount: requiredParameterCount);
+ requiredParameterCount: requiredParameterCount,
+ positionalParameterNames: positionalParameterNames);
}
Supertype buildSupertype(LibraryBuilder library) {

Powered by Google App Engine
This is Rietveld 408576698