| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 dart_style.src.whitespace; | 5 library dart_style.src.whitespace; |
| 6 | 6 |
| 7 /// Constants for the number of spaces for various kinds of indentation. | 7 /// Constants for the number of spaces for various kinds of indentation. |
| 8 class Indent { | 8 class Indent { |
| 9 /// The number of spaces in a block or collection body. | 9 /// The number of spaces in a block or collection body. |
| 10 static const block = 2; | 10 static const block = 2; |
| 11 | 11 |
| 12 /// How much wrapped cascade sections indent. | 12 /// How much wrapped cascade sections indent. |
| 13 static const cascade = 2; | 13 static const cascade = 2; |
| 14 | 14 |
| 15 /// The number of spaces in a single level of expression nesting. | 15 /// The number of spaces in a single level of expression nesting. |
| 16 static const expression = 4; | 16 static const expression = 4; |
| 17 | 17 |
| 18 /// The ":" on a wrapped constructor initialization list. | 18 /// The ":" on a wrapped constructor initialization list. |
| 19 static const constructorInitializer = 4; | 19 static const constructorInitializer = 4; |
| 20 | |
| 21 /// The indentation for subsequent variables when a for loop defines multiple | |
| 22 /// variables that wrap, like: | |
| 23 /// | |
| 24 /// for (var a = initializer, | |
| 25 /// b = another, | |
| 26 /// c = third; | |
| 27 /// a + b + c < 100; | |
| 28 /// a++) { | |
| 29 /// ... | |
| 30 /// } | |
| 31 static const loopVariable = 8; | |
| 32 } | 20 } |
| 33 | 21 |
| 34 /// The kind of pending whitespace that has been "written", but not actually | 22 /// The kind of pending whitespace that has been "written", but not actually |
| 35 /// physically output yet. | 23 /// physically output yet. |
| 36 /// | 24 /// |
| 37 /// We defer actually writing whitespace until a non-whitespace token is | 25 /// We defer actually writing whitespace until a non-whitespace token is |
| 38 /// encountered to avoid trailing whitespace. | 26 /// encountered to avoid trailing whitespace. |
| 39 class Whitespace { | 27 class Whitespace { |
| 40 /// No whitespace. | 28 /// No whitespace. |
| 41 static const none = const Whitespace._("none"); | 29 static const none = const Whitespace._("none"); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 84 |
| 97 default: | 85 default: |
| 98 return 0; | 86 return 0; |
| 99 } | 87 } |
| 100 } | 88 } |
| 101 | 89 |
| 102 const Whitespace._(this.name); | 90 const Whitespace._(this.name); |
| 103 | 91 |
| 104 String toString() => name; | 92 String toString() => name; |
| 105 } | 93 } |
| OLD | NEW |