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

Side by Side Diff: pkg/analyzer/lib/src/services/formatter_impl.dart

Issue 141443011: Constructor initializer indent fixes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/test/services/data/cu_tests.data » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library formatter_impl; 5 library formatter_impl;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/src/generated/parser.dart'; 10 import 'package:analyzer/src/generated/parser.dart';
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 token(SEMI_COLON); 625 token(SEMI_COLON);
626 newlines(); 626 newlines();
627 return; 627 return;
628 } 628 }
629 } 629 }
630 630
631 visitPrefixedBody(space, body); 631 visitPrefixedBody(space, body);
632 } 632 }
633 633
634 visitConstructorInitializers(ConstructorDeclaration node) { 634 visitConstructorInitializers(ConstructorDeclaration node) {
635 newlines(); 635 if (node.initializers.length > 1) {
636 newlines();
637 } else {
638 preserveLeadingNewlines();
639 }
636 indent(2); 640 indent(2);
637 token(node.separator /* : */); 641 token(node.separator /* : */);
638 space(); 642 space();
639 for (var i = 0; i < node.initializers.length; i++) { 643 for (var i = 0; i < node.initializers.length; i++) {
640 if (i > 0) { 644 if (i > 0) {
641 // preceding comma 645 // preceding comma
642 token(node.initializers[i].beginToken.previous); 646 token(node.initializers[i].beginToken.previous);
643 newlines(); 647 newlines();
644 space(n: 2, allowLineLeading: true); 648 space(n: 2, allowLineLeading: true);
645 } 649 }
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 var lastLine = 1708 var lastLine =
1705 lineInfo.getLocation(lastOffset).lineNumber; 1709 lineInfo.getLocation(lastOffset).lineNumber;
1706 var currentLine = 1710 var currentLine =
1707 lineInfo.getLocation(currentOffset).lineNumber; 1711 lineInfo.getLocation(currentOffset).lineNumber;
1708 return currentLine - lastLine; 1712 return currentLine - lastLine;
1709 } 1713 }
1710 1714
1711 String toString() => writer.toString(); 1715 String toString() => writer.toString();
1712 1716
1713 } 1717 }
OLDNEW
« 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