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

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

Issue 231743002: Fix constructor initializer space conventions (dartbug.com/17642). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 644
645 visitPrefixedBody(space, body); 645 visitPrefixedBody(space, body);
646 } 646 }
647 647
648 visitConstructorInitializers(ConstructorDeclaration node) { 648 visitConstructorInitializers(ConstructorDeclaration node) {
649 if (node.initializers.length > 1) { 649 if (node.initializers.length > 1) {
650 newlines(); 650 newlines();
651 } else { 651 } else {
652 preserveLeadingNewlines(); 652 preserveLeadingNewlines();
653 space();
653 } 654 }
654 indent(2); 655 indent(2);
655 token(node.separator /* : */); 656 token(node.separator /* : */);
656 space(); 657 space();
657 for (var i = 0; i < node.initializers.length; i++) { 658 for (var i = 0; i < node.initializers.length; i++) {
658 if (i > 0) { 659 if (i > 0) {
659 // preceding comma 660 // preceding comma
660 token(node.initializers[i].beginToken.previous); 661 token(node.initializers[i].beginToken.previous);
661 newlines(); 662 newlines();
662 space(n: 2, allowLineLeading: true); 663 space(n: 2, allowLineLeading: true);
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 var lastLine = 1754 var lastLine =
1754 lineInfo.getLocation(lastOffset).lineNumber; 1755 lineInfo.getLocation(lastOffset).lineNumber;
1755 var currentLine = 1756 var currentLine =
1756 lineInfo.getLocation(currentOffset).lineNumber; 1757 lineInfo.getLocation(currentOffset).lineNumber;
1757 return currentLine - lastLine; 1758 return currentLine - lastLine;
1758 } 1759 }
1759 1760
1760 String toString() => writer.toString(); 1761 String toString() => writer.toString();
1761 1762
1762 } 1763 }
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