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

Side by Side Diff: lib/src/chunk.dart

Issue 1180443003: Don't allow inline block comments to eat pending newlines. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Add a test. Created 5 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
« no previous file with comments | « no previous file | lib/src/chunk_builder.dart » ('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) 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
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 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/chunk_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698