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

Unified Diff: pkg/kernel/lib/ast.dart

Issue 2990783002: Serialize typedef parameters (including function typed ones) to Kernel and use it to resynthesize t… (Closed)
Patch Set: Test for named parameters. 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/kernel/lib/ast.dart
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index aa87ce4365967d195807defef4037c6bfd6cce83..2d3099c58100a8f49a1731129cdc2e849461a174 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -493,6 +493,16 @@ class Typedef extends NamedNode {
List<Expression> annotations = const <Expression>[];
String name;
final List<TypeParameter> typeParameters;
+
+ @informative
+ int requiredParameterCount = 0;
+
+ @informative
+ List<VariableDeclaration> positionalParameters = <VariableDeclaration>[];
+
+ @informative
+ List<VariableDeclaration> namedParameters = <VariableDeclaration>[];
+
DartType type;
Typedef(this.name, this.type,
@@ -508,9 +518,22 @@ class Typedef extends NamedNode {
return v.visitTypedef(this);
}
+ void setParameters(
+ int requiredParameterCount,
+ List<VariableDeclaration> positionalParameters,
+ List<VariableDeclaration> namedParameters) {
+ this.requiredParameterCount = requiredParameterCount;
+ this.positionalParameters = positionalParameters;
+ this.namedParameters = namedParameters;
+ setParents(this.positionalParameters, this);
+ setParents(this.namedParameters, this);
+ }
+
transformChildren(Transformer v) {
transformList(annotations, v, this);
transformList(typeParameters, v, this);
+ transformList(positionalParameters, v, this);
+ transformList(namedParameters, v, this);
if (type != null) {
type = v.visitDartType(type);
}
@@ -519,6 +542,9 @@ class Typedef extends NamedNode {
visitChildren(Visitor v) {
visitList(annotations, v);
visitList(typeParameters, v);
+ visitList(typeParameters, v);
+ visitList(positionalParameters, v);
+ visitList(namedParameters, v);
type?.accept(v);
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart ('k') | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698