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

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

Issue 319063004: Formatter: don't indent EOL comment at the beginning of a line. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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
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 source_writer; 5 library source_writer;
6 6
7 7
8 8
9 class Line { 9 class Line {
10 10
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 void addSpaces(int n, {breakWeight: DEFAULT_SPACE_WEIGHT}) { 28 void addSpaces(int n, {breakWeight: DEFAULT_SPACE_WEIGHT}) {
29 tokens.add(new SpaceToken(n, breakWeight: breakWeight)); 29 tokens.add(new SpaceToken(n, breakWeight: breakWeight));
30 } 30 }
31 31
32 void addToken(LineToken token) { 32 void addToken(LineToken token) {
33 tokens.add(token); 33 tokens.add(token);
34 } 34 }
35 35
36 void clear() {
37 tokens.clear();
38 }
39
36 bool isEmpty() => tokens.isEmpty; 40 bool isEmpty() => tokens.isEmpty;
37 41
38 bool isWhitespace() => tokens.every( 42 bool isWhitespace() => tokens.every(
39 (tok) => tok is SpaceToken || tok is TabToken); 43 (tok) => tok is SpaceToken || tok is TabToken);
40 44
41 void indent(int n) { 45 void indent(int n) {
42 tokens.insert(0, 46 tokens.insert(0,
43 useTabs ? new TabToken(n) : new SpaceToken(n * spacesPerIndent)); 47 useTabs ? new TabToken(n) : new SpaceToken(n * spacesPerIndent));
44 } 48 }
45 49
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 436
433 String getTabs(int n) => n < TABS.length ? TABS[n] : repeat('\t', n); 437 String getTabs(int n) => n < TABS.length ? TABS[n] : repeat('\t', n);
434 438
435 String repeat(String ch, int times) { 439 String repeat(String ch, int times) {
436 var sb = new StringBuffer(); 440 var sb = new StringBuffer();
437 for (var i = 0; i < times; ++i) { 441 for (var i = 0; i < times; ++i) {
438 sb.write(ch); 442 sb.write(ch);
439 } 443 }
440 return sb.toString(); 444 return sb.toString();
441 } 445 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/services/formatter_impl.dart ('k') | pkg/analyzer/test/services/formatter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698