Migrate pkg/smith to the new constructor syntax.

Change-Id: I5f17f4a7eddd5dd839b2061f5d4a1f33c40703a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506661
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This commit is contained in:
Robert Nystrom
2026-05-27 16:54:31 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 5ccd5818e0
commit 6c88c6f2ba
5 changed files with 19 additions and 15 deletions
+4
View File
@@ -3,3 +3,7 @@ include: package:lints/recommended.yaml
analyzer: analyzer:
language: language:
strict-casts: true strict-casts: true
linter:
rules:
- unnecessary_const_in_enum_constructor
- unnecessary_type_name_in_constructor
+2 -2
View File
@@ -26,7 +26,7 @@ class Step {
final bool isTestRunner; final bool isTestRunner;
final Configuration? testedConfiguration; final Configuration? testedConfiguration;
Step(this.name, String? script, this.arguments, this.environment, new(this.name, String? script, this.arguments, this.environment,
this.fileSet, this.shards, this.isTestRunner, this.testedConfiguration) this.fileSet, this.shards, this.isTestRunner, this.testedConfiguration)
: script = script ?? testScriptName; : script = script ?? testScriptName;
@@ -102,7 +102,7 @@ class Builder {
final Runtime? runtime; final Runtime? runtime;
final Set<Configuration> testedConfigurations; final Set<Configuration> testedConfigurations;
Builder(this.name, this.description, this.steps, this.system, this.mode, new(this.name, this.description, this.steps, this.system, this.mode,
this.arch, this.sanitizer, this.runtime, this.testedConfigurations); this.arch, this.sanitizer, this.runtime, this.testedConfigurations);
/// Create a [Builder] from its name, a list of 'step templates', the /// Create a [Builder] from its name, a list of 'step templates', the
+11 -11
View File
@@ -381,7 +381,7 @@ class Configuration {
final bool useQemu; final bool useQemu;
Configuration(this.name, this.architecture, this.compiler, this.mode, new(this.name, this.architecture, this.compiler, this.mode,
this.runtime, this.system, this.runtime, this.system,
{NnbdMode? nnbdMode, {NnbdMode? nnbdMode,
Sanitizer? sanitizer, Sanitizer? sanitizer,
@@ -439,7 +439,7 @@ class Configuration {
/// ///
/// NOTE: All parameters should be required to ensure that cloning factories /// NOTE: All parameters should be required to ensure that cloning factories
/// are updated when new class fields are added. /// are updated when new class fields are added.
Configuration._cloneHelper( new _cloneHelper(
this.name, this.name,
this.architecture, this.architecture,
this.compiler, this.compiler,
@@ -475,7 +475,7 @@ class Configuration {
/// ///
/// NOTE: This calls [_cloneHelper] instead of the default constructor to /// NOTE: This calls [_cloneHelper] instead of the default constructor to
/// ensure it gets updated whenever new fields are added to the class. /// ensure it gets updated whenever new fields are added to the class.
factory Configuration.detectHost(Configuration source) => factory detectHost(Configuration source) =>
Configuration._cloneHelper( Configuration._cloneHelper(
'${source.name}-detect-host-${_detectHostNumber++}', '${source.name}-detect-host-${_detectHostNumber++}',
Architecture.host, Architecture.host,
@@ -740,7 +740,7 @@ enum Architecture {
final String name; final String name;
final bool isSimulator; final bool isSimulator;
const Architecture._(this.name, {this.isSimulator = false}); new _(this.name, {this.isSimulator = false});
static final List<String> names = _all.keys.toList(); static final List<String> names = _all.keys.toList();
@@ -819,7 +819,7 @@ enum GenSnapshotFormat {
final String name; final String name;
final String fileOption; final String fileOption;
const GenSnapshotFormat(this.name, this.fileOption); new(this.name, this.fileOption);
static final _all = Map<String, GenSnapshotFormat>.fromIterable( static final _all = Map<String, GenSnapshotFormat>.fromIterable(
values, values,
@@ -903,7 +903,7 @@ enum Compiler {
final String name; final String name;
final List<Runtime> supportedRuntimes; final List<Runtime> supportedRuntimes;
final Mode defaultMode; final Mode defaultMode;
const Compiler._(this.name, new _(this.name,
{this.supportedRuntimes = const [Runtime.none], {this.supportedRuntimes = const [Runtime.none],
this.defaultMode = Mode.debug}); this.defaultMode = Mode.debug});
@@ -948,7 +948,7 @@ enum Mode {
} }
final String name; final String name;
const Mode._(this.name); new _(this.name);
bool get isDebug => this == debug; bool get isDebug => this == debug;
@@ -978,7 +978,7 @@ enum Sanitizer {
} }
final String name; final String name;
const Sanitizer._(this.name); new _(this.name);
@override @override
String toString() => name; String toString() => name;
@@ -1015,7 +1015,7 @@ enum Runtime {
/// Whether this runtime is a command-line JavaScript environment. /// Whether this runtime is a command-line JavaScript environment.
final bool isJSCommandLine; final bool isJSCommandLine;
const Runtime._(this.name, new _(this.name,
{this.isBrowser = false, this.isJSCommandLine = false}); {this.isBrowser = false, this.isJSCommandLine = false});
bool get isSafari => name.startsWith("safari"); bool get isSafari => name.startsWith("safari");
@@ -1089,7 +1089,7 @@ enum System {
/// The root directory name for build outputs on this system. /// The root directory name for build outputs on this system.
final String outputDirectory; final String outputDirectory;
const System._(this.name, {this.outputDirectory = 'out/'}); new _(this.name, {this.outputDirectory = 'out/'});
@override @override
String toString() => name; String toString() => name;
@@ -1123,7 +1123,7 @@ enum NnbdMode {
} }
final String name; final String name;
const NnbdMode._(this.name); new _(this.name);
@override @override
String toString() => name; String toString() => name;
+1 -1
View File
@@ -77,5 +77,5 @@ class TestMatrix {
return TestMatrix._(configurations, builders, branches); return TestMatrix._(configurations, builders, branches);
} }
TestMatrix._(this.configurations, this.builders, this.branches); new _(this.configurations, this.builders, this.branches);
} }
+1 -1
View File
@@ -4,7 +4,7 @@ description: Shared code for working with the Dart SDK's tests and test runner.
publish_to: none publish_to: none
environment: environment:
sdk: '^3.12.0-0' sdk: '^3.13.0-0'
resolution: workspace resolution: workspace