Skip to content

Commit

Permalink
[dartdev] Avoid unnecessary uses of late
Browse files Browse the repository at this point in the history
Change-Id: I702e5c91e803b06dd1321efe563c104bc00c19d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368740
Reviewed-by: Derek Xu <[email protected]>
Reviewed-by: Ben Konyi <[email protected]>
Commit-Queue: Ben Konyi <[email protected]>
  • Loading branch information
parlough authored and Commit Queue committed May 30, 2024
1 parent e3f2d23 commit fef2ba3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/dartdev/lib/dartdev.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DartdevRunner extends CommandRunner<int> {
'A command-line utility for Dart development';

@override
late final ArgParser argParser;
final ArgParser argParser;

final bool verbose;

Expand Down
4 changes: 2 additions & 2 deletions pkg/dartdev/lib/src/commands/compile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,8 @@ Sets the verbosity level of the compilation.
flagDefaultsTo: true,
);

late final Option defineOption;
late final Option packagesOption;
final Option defineOption;
final Option packagesOption;

CompileSubcommandCommand(super.name, super.description, super.verbose,
{super.hidden})
Expand Down
4 changes: 2 additions & 2 deletions pkg/dartdev/lib/src/dds_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DDSRunner {
const devToolsMessagePrefix =
'The Dart DevTools debugger and profiler is available at:';
if (debugDds) {
late StreamSubscription stdoutSub;
late final StreamSubscription stdoutSub;
stdoutSub = process.stdout.transform(utf8.decoder).listen((event) {
if (event.startsWith(devToolsMessagePrefix)) {
final ddsDebuggingUri = event.split(' ').last;
Expand All @@ -61,7 +61,7 @@ class DDSRunner {
}
});
}
late StreamSubscription stderrSub;
late final StreamSubscription stderrSub;
stderrSub = process.stderr.transform(utf8.decoder).listen((event) {
final result = json.decode(event) as Map<String, dynamic>;
final state = result['state'];
Expand Down
2 changes: 1 addition & 1 deletion pkg/dartdev/lib/src/generate_kernel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Future<void> ensureCompilationServerIsRunning(
}
try {
Directory(p.dirname(serverInfoFile.path)).createSync(recursive: true);
late final Process frontendServerProcess;
final Process frontendServerProcess;
if (File(sdk.frontendServerAotSnapshot).existsSync()) {
frontendServerProcess = await Process.start(
sdk.dartAotRuntime,
Expand Down
4 changes: 1 addition & 3 deletions pkg/dartdev/tool/sdk_size.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import 'dart:io';

import 'package:path/path.dart' as p;

late final String dartSdkPath;
final String dartSdkPath = p.dirname(p.dirname(Platform.resolvedExecutable));

final List<FileStats> fileStats = [];

void main(List<String> arguments) {
final vm = Platform.resolvedExecutable;
dartSdkPath = p.dirname(p.dirname(vm));
final version =
File(p.join(dartSdkPath, 'version')).readAsStringSync().trim();

Expand Down

0 comments on commit fef2ba3

Please sign in to comment.