Index: pkg/kernel/lib/text/ast_to_text.dart |
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart |
index 03f7fa6382646163e47475975ef80690ae46503e..198c21462d0cd9b6da7859e38e559d4603721602 100644 |
--- a/pkg/kernel/lib/text/ast_to_text.dart |
+++ b/pkg/kernel/lib/text/ast_to_text.dart |
@@ -210,6 +210,12 @@ class Printer extends Visitor<Null> { |
return '$library::$name'; |
} |
+ String getTypedefReference(Typedef node) { |
+ if (node == null) return '<No Typedef>'; |
+ String library = getLibraryReference(node.enclosingLibrary); |
+ return '$library::${node.name}'; |
+ } |
+ |
static final String emptyNameString = '•'; |
static final Name emptyName = new Name(emptyNameString); |
@@ -281,6 +287,7 @@ class Printer extends Visitor<Null> { |
} |
endLine(); |
var inner = new Printer._inner(this, imports); |
+ library.typedefs.forEach(inner.writeNode); |
library.classes.forEach(inner.writeNode); |
library.fields.forEach(inner.writeNode); |
library.procedures.forEach(inner.writeNode); |
@@ -313,6 +320,7 @@ class Printer extends Visitor<Null> { |
writeWord(prefix); |
endLine(' {'); |
++inner.indentation; |
+ library.typedefs.forEach(inner.writeNode); |
library.classes.forEach(inner.writeNode); |
library.fields.forEach(inner.writeNode); |
library.procedures.forEach(inner.writeNode); |
@@ -429,6 +437,15 @@ class Printer extends Visitor<Null> { |
writeWord('Vector'); |
} |
+ visitTypedefType(TypedefType type) { |
+ writeTypedefReference(type.typedefNode); |
+ if (type.typeArguments.isNotEmpty) { |
+ writeSymbol('<'); |
+ writeList(type.typeArguments, writeType); |
+ writeSymbol('>'); |
+ } |
+ } |
+ |
void writeModifier(bool isThere, String name) { |
if (isThere) { |
writeWord(name); |
@@ -610,6 +627,10 @@ class Printer extends Visitor<Null> { |
writeWord(getClassReference(classNode)); |
} |
+ void writeTypedefReference(Typedef typedefNode) { |
+ writeWord(getTypedefReference(typedefNode)); |
+ } |
+ |
void writeLibraryReference(Library library) { |
writeWord(getLibraryReference(library)); |
} |
@@ -751,6 +772,16 @@ class Printer extends Visitor<Null> { |
endLine('}'); |
} |
+ visitTypedef(Typedef node) { |
+ writeIndentation(); |
+ writeWord('typedef'); |
+ writeWord(node.name); |
+ writeTypeParameterList(node.typeParameters); |
+ writeSpaced('='); |
+ writeNode(node.type); |
+ endLine(';'); |
+ } |
+ |
visitInvalidExpression(InvalidExpression node) { |
writeWord('invalid-expression'); |
} |