Apply review changes.
diff --git a/lib/src/chunk_builder.dart b/lib/src/chunk_builder.dart
index b2e08d4..249250e 100644
--- a/lib/src/chunk_builder.dart
+++ b/lib/src/chunk_builder.dart
@@ -588,7 +588,9 @@
/// Starts a new block as a child of the current chunk.
///
- /// Nested blocks are handled using their own independent [LineWriter].
+ /// Nested blocks are handled using their own independent [LineWriter]. If
+ /// [indent] is `false` then the first line of the block will not get a level
+ /// of leading indentation. Otherwise it does.
ChunkBuilder startBlock(Chunk? argumentChunk, {bool indent = true}) {
var chunk = _chunks.last;
chunk.makeBlock(argumentChunk, indent: indent);
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index ccb00c4..9b0517d 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -634,15 +634,7 @@
///
/// To handle that, we don't put the last section in the block and instead
/// format it with the surrounding expression. So, from the formatter's
- /// view, a cascade like:
- ///
- /// var x = someLeadingExpression
- /// ..firstCascade()
- /// ..secondCascade()
- /// ..thirdCascade()
- /// ..fourthCascade();
- ///
- /// Is formatted like:
+ /// view, the above casade is formatted like:
///
/// var x = someLeadingExpression
/// [ begin block ]
@@ -665,7 +657,12 @@
zeroSplit();
// If there are comments before the first section, keep them outside of the
- // block.
+ // block. That way code like:
+ //
+ // receiver // comment
+ // ..cascade();
+ //
+ // Keeps the comment on the first line.
var firstCommentToken = node.cascadeSections.first.beginToken;
writePrecedingCommentsAndNewlines(firstCommentToken);
_suppressPrecedingCommentsAndNewLines.add(firstCommentToken);
diff --git a/tool/change_metrics.dart b/tool/change_metrics.dart
deleted file mode 100644
index ab67523..0000000
--- a/tool/change_metrics.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-import 'dart:io';
-
-/// Calculates the amount of formatting changes in a given directory of code.
-///
-/// This should be run with a path to a directory. That directory should
-/// contain a Git repo. The committed state of the repo should be the formatted
-/// output before the change in question. Then the result of the new formatting
-/// should be unstaged changes.
-///
-/// Uses `git diff --shortstat` to calculate the number of changed lines.
-///
-/// Counts the number of lines of Dart code by reading the files.
-void main(List<String> arguments) {
- if (arguments.length != 1) {
- print('Usage: change_metrics.dart <dir>');
- exit(1);
- }
-
- var directory = arguments[0];
- var totalLines = 0;
- var totalFiles = 0;
-
- print('Counting lines...');
- for (var entry in Directory(directory).listSync(recursive: true)) {
- if (entry is File && entry.path.endsWith('.dart')) {
- try {
- var lines = entry.readAsLinesSync();
- totalFiles++;
- totalLines += lines.length;
- } catch (error) {
- print('Could not read ${entry.path}:\n$error');
- }
- }
- }
-
- print('Getting diff stats...');
- var result = Process.runSync('git', ['diff', '--shortstat'],
- workingDirectory: directory);
- if (result.exitCode != 0) {
- print('Git failure:\n${result.stdout}\n${result.stderr}');
- exit(1);
- }
-
- var stdout = result.stdout as String;
- var insertions = _parseGitStdout(stdout, r'(\d+) insertions');
- var deletions = _parseGitStdout(stdout, r'(\d+) deletions');
- var changes = insertions + deletions;
-
- print('$totalLines lines in $totalFiles files');
- print('$insertions insertions + $deletions deletions = $changes changes');
- var linesPerChange = totalLines / changes;
- print('1 changed line for every ${linesPerChange.toStringAsFixed(2)} '
- 'lines of code');
-
- var changesPerLine = 1000.0 * changes / totalLines;
- print('${changesPerLine.toStringAsFixed(4)} '
- 'changed lines for every 1,000 lines of code');
-}
-
-int _parseGitStdout(String stdout, String pattern) {
- var match = RegExp(pattern).firstMatch(stdout);
- if (match == null) {
- print('Could not parse Git output:\n$stdout');
- exit(1);
- }
-
- return int.parse(match[1]!);
-}