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

Unified Diff: pkg/analyzer/lib/src/services/formatter_impl.dart

Issue 102763007: Function Decl formatter fixes (external and getters/setters) --- (dartbug.com/15914). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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/test/services/data/cu_tests.data » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/services/formatter_impl.dart
===================================================================
--- pkg/analyzer/lib/src/services/formatter_impl.dart (revision 31484)
+++ pkg/analyzer/lib/src/services/formatter_impl.dart (working copy)
@@ -815,8 +815,15 @@
visitFunctionDeclaration(FunctionDeclaration node) {
preserveLeadingNewlines();
- visitNode(node.returnType, followedBy: space);
- token(node.propertyKeyword, followedBy: space);
+ modifier(node.externalKeyword);
+ //TODO(pquitslund): remove this workaround once setter functions
+ //have their return types properly set (dartbug.com/15914)
+ if (node.returnType == null && node.propertyKeyword != null) {
+ modifier(node.propertyKeyword.previous);
+ } else {
+ visitNode(node.returnType, followedBy: space);
+ }
+ modifier(node.propertyKeyword);
visit(node.name);
visit(node.functionExpression);
}
@@ -827,7 +834,9 @@
visitFunctionExpression(FunctionExpression node) {
visit(node.parameters);
- space();
+ if (node.body is! EmptyFunctionBody) {
+ space();
+ }
visit(node.body);
}
« no previous file with comments | « no previous file | pkg/analyzer/test/services/data/cu_tests.data » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698