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

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

Issue 474363002: Tweak for formatting constructor initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/style_guide_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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 673 }
674 674
675 visitPrefixedBody(space, body); 675 visitPrefixedBody(space, body);
676 } 676 }
677 677
678 visitConstructorInitializers(ConstructorDeclaration node) { 678 visitConstructorInitializers(ConstructorDeclaration node) {
679 if (node.initializers.length > 1) { 679 if (node.initializers.length > 1) {
680 newlines(); 680 newlines();
681 } else { 681 } else {
682 preserveLeadingNewlines(); 682 preserveLeadingNewlines();
683 space(); 683 levelSpace(lastSpaceWeight++);
684 } 684 }
685 indent(2); 685 indent(2);
686 token(node.separator /* : */); 686 token(node.separator /* : */);
687 space(); 687 space();
688 for (var i = 0; i < node.initializers.length; i++) { 688 for (var i = 0; i < node.initializers.length; i++) {
689 if (i > 0) { 689 if (i > 0) {
690 // preceding comma 690 // preceding comma
691 token(node.initializers[i].beginToken.previous); 691 token(node.initializers[i].beginToken.previous);
692 newlines(); 692 newlines();
693 space(n: 2, allowLineLeading: true); 693 space(n: 2, allowLineLeading: true);
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 @override 1852 @override
1853 visitEnumConstantDeclaration(EnumConstantDeclaration node) { 1853 visitEnumConstantDeclaration(EnumConstantDeclaration node) {
1854 // TODO: implement visitEnumConstantDeclaration 1854 // TODO: implement visitEnumConstantDeclaration
1855 } 1855 }
1856 1856
1857 @override 1857 @override
1858 visitEnumDeclaration(EnumDeclaration node) { 1858 visitEnumDeclaration(EnumDeclaration node) {
1859 // TODO: implement visitEnumDeclaration 1859 // TODO: implement visitEnumDeclaration
1860 } 1860 }
1861 } 1861 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/services/data/style_guide_tests.data » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698