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

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

Issue 150533003: Indent fix for switch statement defaults (dartbug.com/16406). (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/stmt_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/java_core.dart' show CharSequence; 10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence;
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 newlines(); 1194 newlines();
1195 indent(); 1195 indent();
1196 visitNodes(node.statements, separatedBy: newlines); 1196 visitNodes(node.statements, separatedBy: newlines);
1197 unindent(); 1197 unindent();
1198 } 1198 }
1199 1199
1200 visitSwitchDefault(SwitchDefault node) { 1200 visitSwitchDefault(SwitchDefault node) {
1201 visitNodes(node.labels, separatedBy: space, followedBy: space); 1201 visitNodes(node.labels, separatedBy: space, followedBy: space);
1202 token(node.keyword); 1202 token(node.keyword);
1203 token(node.colon); 1203 token(node.colon);
1204 space(); 1204 newlines();
1205 visitNodes(node.statements, separatedBy: space); 1205 indent();
1206 visitNodes(node.statements, separatedBy: newlines);
1207 unindent();
1206 } 1208 }
1207 1209
1208 visitSwitchStatement(SwitchStatement node) { 1210 visitSwitchStatement(SwitchStatement node) {
1209 token(node.keyword); 1211 token(node.keyword);
1210 space(); 1212 space();
1211 token(node.leftParenthesis); 1213 token(node.leftParenthesis);
1212 visit(node.expression); 1214 visit(node.expression);
1213 token(node.rightParenthesis); 1215 token(node.rightParenthesis);
1214 space(); 1216 space();
1215 token(node.leftBracket); 1217 token(node.leftBracket);
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 var lastLine = 1688 var lastLine =
1687 lineInfo.getLocation(lastOffset).lineNumber; 1689 lineInfo.getLocation(lastOffset).lineNumber;
1688 var currentLine = 1690 var currentLine =
1689 lineInfo.getLocation(currentOffset).lineNumber; 1691 lineInfo.getLocation(currentOffset).lineNumber;
1690 return currentLine - lastLine; 1692 return currentLine - lastLine;
1691 } 1693 }
1692 1694
1693 String toString() => writer.toString(); 1695 String toString() => writer.toString();
1694 1696
1695 } 1697 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/services/data/stmt_tests.data » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698