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

Unified Diff: lib/src/source_visitor.dart

Issue 815423003: Don't put spaces in empty for loop clauses. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 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 | « CHANGELOG.md ('k') | test/regression/132.stmt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source_visitor.dart
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index fc0deced94da881f57d03779b66a8b74d9ec4147..9213905fda440ca2d30d99b092df9525b54b4cd0 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -753,36 +753,32 @@ class SourceVisitor implements AstVisitor {
// The initialization clause.
if (node.initialization != null) {
visit(node.initialization);
- } else {
- if (node.variables == null) {
- space();
- } else {
- // Indent split variables more so they aren't at the same level
- // as the rest of the loop clauses.
- _writer.indent(4);
+ } else if (node.variables != null) {
+ // Indent split variables more so they aren't at the same level
+ // as the rest of the loop clauses.
+ _writer.indent(4);
- var declaration = node.variables;
- visitDeclarationMetadata(declaration.metadata);
- modifier(declaration.keyword);
- visit(declaration.type, after: space);
+ var declaration = node.variables;
+ visitDeclarationMetadata(declaration.metadata);
+ modifier(declaration.keyword);
+ visit(declaration.type, after: space);
- visitCommaSeparatedNodes(declaration.variables, between: () {
- _writer.multisplit(space: true, nest: true);
- });
+ visitCommaSeparatedNodes(declaration.variables, between: () {
+ _writer.multisplit(space: true, nest: true);
+ });
- _writer.unindent(4);
- }
+ _writer.unindent(4);
}
token(node.leftSeparator);
- _writer.multisplit(nest: true, space: true);
// The condition clause.
+ if (node.condition != null) _writer.multisplit(nest: true, space: true);
visit(node.condition);
token(node.rightSeparator);
// The update clause.
- if (node.updaters != null) {
+ if (node.updaters.isNotEmpty) {
_writer.multisplit(nest: true, space: true);
visitCommaSeparatedNodes(node.updaters,
between: () => _writer.multisplit(nest: true, space: true));
« no previous file with comments | « CHANGELOG.md ('k') | test/regression/132.stmt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698