| 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.chunk; | 5 library dart_style.src.chunk; |
| 6 | 6 |
| 7 import 'fast_hash.dart'; | 7 import 'fast_hash.dart'; |
| 8 import 'rule/rule.dart'; | 8 import 'rule/rule.dart'; |
| 9 | 9 |
| 10 /// Tracks where a selection start or end point may appear in some piece of | 10 /// Tracks where a selection start or end point may appear in some piece of |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 /// A comment in the source, with a bit of information about the surrounding | 328 /// A comment in the source, with a bit of information about the surrounding |
| 329 /// whitespace. | 329 /// whitespace. |
| 330 class SourceComment extends Selection { | 330 class SourceComment extends Selection { |
| 331 /// The text of the comment, including `//`, `/*`, and `*/`. | 331 /// The text of the comment, including `//`, `/*`, and `*/`. |
| 332 final String text; | 332 final String text; |
| 333 | 333 |
| 334 /// The number of newlines between the comment or token preceding this comment | 334 /// The number of newlines between the comment or token preceding this comment |
| 335 /// and the beginning of this one. | 335 /// and the beginning of this one. |
| 336 /// | 336 /// |
| 337 /// Will be zero if the comment is a trailing one. | 337 /// Will be zero if the comment is a trailing one. |
| 338 final int linesBefore; | 338 int linesBefore; |
| 339 | 339 |
| 340 /// Whether this comment is a line comment. | 340 /// Whether this comment is a line comment. |
| 341 final bool isLineComment; | 341 final bool isLineComment; |
| 342 | 342 |
| 343 /// Whether this comment starts at column one in the source. | 343 /// Whether this comment starts at column one in the source. |
| 344 /// | 344 /// |
| 345 /// Comments that start at the start of the line will not be indented in the | 345 /// Comments that start at the start of the line will not be indented in the |
| 346 /// output. This way, commented out chunks of code do not get erroneously | 346 /// output. This way, commented out chunks of code do not get erroneously |
| 347 /// re-indented. | 347 /// re-indented. |
| 348 final bool isStartOfLine; | 348 final bool isStartOfLine; |
| 349 | 349 |
| 350 /// Whether this comment is an inline block comment. |
| 351 bool get isInline => linesBefore == 0 && !isLineComment; |
| 352 |
| 350 SourceComment(this.text, this.linesBefore, | 353 SourceComment(this.text, this.linesBefore, |
| 351 {this.isLineComment, this.isStartOfLine}); | 354 {this.isLineComment, this.isStartOfLine}); |
| 352 } | 355 } |
| OLD | NEW |