| Index: pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
|
| ===================================================================
|
| --- pkg/analyzer_experimental/lib/src/services/formatter_impl.dart (revision 27350)
|
| +++ pkg/analyzer_experimental/lib/src/services/formatter_impl.dart (working copy)
|
| @@ -455,6 +455,9 @@
|
|
|
| // Handle trailing whitespace
|
| token(node.endToken /* EOF */);
|
| +
|
| + // Be a good citizen, end with a NL
|
| + ensureTrailingNewline();
|
| }
|
|
|
| visitConditionalExpression(ConditionalExpression node) {
|
| @@ -1210,7 +1213,7 @@
|
|
|
| /// Append the given [string] to the source writer if it's non-null.
|
| append(String string) {
|
| - if (string != null) {
|
| + if (string != null && !string.isEmpty) {
|
| writer.print(string);
|
| }
|
| }
|
| @@ -1266,6 +1269,14 @@
|
| return lines;
|
| }
|
|
|
| +
|
| + ensureTrailingNewline() {
|
| + if (writer.lastToken is! NewlineToken) {
|
| + writer.newline();
|
| + }
|
| + }
|
| +
|
| +
|
| /// Test if this [comment] is at the end of a line.
|
| bool isAtEOL(Token comment) =>
|
| comment != null && comment.toString().trim().startsWith(twoSlashes) &&
|
|
|