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

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

Issue 153203002: Indent fix for trailing comments (dartbug.com/16383). (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/lib/src/services/writer.dart » ('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 32259)
+++ pkg/analyzer/lib/src/services/formatter_impl.dart (working copy)
@@ -454,9 +454,8 @@
token(node.leftBracket);
indent();
visitNodes(node.statements, precededBy: newlines, separatedBy: newlines);
- unindent();
newlines();
- token(node.rightBracket);
+ token(node.rightBracket, precededBy: unindent);
}
visitBlockFunctionBody(BlockFunctionBody node) {
@@ -525,9 +524,8 @@
token(node.leftBracket);
indent();
visitNodes(node.members, precededBy: newlines, separatedBy: newlines);
- unindent();
newlines();
- token(node.rightBracket);
+ token(node.rightBracket, precededBy: unindent);
}
visitClassTypeAlias(ClassTypeAlias node) {
@@ -994,8 +992,7 @@
indent();
visitCommaSeparatedNodes(node.elements /*, followedBy: breakableSpace*/);
optionalTrailingComma(node.rightBracket);
- unindent();
- token(node.rightBracket);
+ token(node.rightBracket, precededBy: unindent);
}
visitMapLiteral(MapLiteral node) {
@@ -1218,8 +1215,8 @@
indent();
newlines();
visitNodes(node.members, separatedBy: newlines, followedBy: newlines);
- unindent();
- token(node.rightBracket);
+ token(node.rightBracket, precededBy: unindent);
+
}
visitSymbolLiteral(SymbolLiteral node) {
@@ -1442,8 +1439,8 @@
preserveNewlines = true;
}
- token(Token token, {precededBy(), followedBy(),
- printToken(tok), int minNewlines: 0}) {
+ token(Token token, {precededBy(), followedBy(), printToken(tok),
+ int minNewlines: 0}) {
if (token != null) {
if (needsNewline) {
minNewlines = max(1, minNewlines);
@@ -1512,7 +1509,7 @@
append(String string) {
if (string != null && !string.isEmpty) {
emitSpaces();
- writer.print(string);
+ writer.write(string);
}
}
@@ -1538,8 +1535,7 @@
newlines();
visit(statement);
newlines();
- unindent();
- token(CLOSE_CURLY);
+ token(CLOSE_CURLY, precededBy: unindent);
} else {
visit(statement);
}
@@ -1566,6 +1562,7 @@
lines = max(min, countNewlinesBetween(previousToken, currentToken));
preserveNewlines = false;
}
+
emitNewlines(lines);
previousToken =
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/services/writer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698