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

Unified Diff: pkg/analyzer/lib/src/dart/ast/utilities.dart

Issue 2752853002: Improve printing of generic function types and add tests (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/ast/utilities.dart
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 8090044bd44fd349f44a5500ce2be22383cc9402..718f9436c83053018d676eab014088b891f35a88 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -7537,7 +7537,7 @@ class ToSourceVisitor implements AstVisitor<Object> {
@override
Object visitGenericFunctionType(GenericFunctionType node) {
_visitNode(node.returnType);
- _writer.print(' Function ');
+ _writer.print(' Function');
_visitNode(node.typeParameters);
_visitNode(node.parameters);
return null;
@@ -7880,7 +7880,10 @@ class ToSourceVisitor implements AstVisitor<Object> {
_visitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
_visitTokenWithSuffix(node.covariantKeyword, ' ');
_visitTokenWithSuffix(node.keyword, " ");
- _visitNodeWithSuffix(node.type, " ");
+ _visitNode(node.type);
+ if (node.type != null && node.identifier != null) {
+ _writer.print(' ');
+ }
_visitNode(node.identifier);
return null;
}
@@ -8847,7 +8850,7 @@ class ToSourceVisitor2 implements AstVisitor<Object> {
@override
Object visitGenericFunctionType(GenericFunctionType node) {
safelyVisitNode(node.returnType);
- sink.write(' Function ');
+ sink.write(' Function');
safelyVisitNode(node.typeParameters);
safelyVisitNode(node.parameters);
return null;
@@ -9190,7 +9193,10 @@ class ToSourceVisitor2 implements AstVisitor<Object> {
safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
safelyVisitTokenWithSuffix(node.covariantKeyword, ' ');
safelyVisitTokenWithSuffix(node.keyword, " ");
- safelyVisitNodeWithSuffix(node.type, " ");
+ safelyVisitNode(node.type);
+ if (node.type != null && node.identifier != null) {
+ sink.write(' ');
+ }
safelyVisitNode(node.identifier);
return null;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698