Rename arguments from checked to enableAsserts (#2373)
For fewer references to the legacy name and to match the option that
users would pass.
diff --git a/lib/src/command/global_run.dart b/lib/src/command/global_run.dart
index cac856b..221d05c 100644
--- a/lib/src/command/global_run.dart
+++ b/lib/src/command/global_run.dart
@@ -58,7 +58,7 @@
}
var exitCode = await globals.runExecutable(package, executable, args,
- checked: argResults['enable-asserts'] || argResults['checked']);
+ enableAsserts: argResults['enable-asserts'] || argResults['checked']);
await flushThenExit(exitCode);
}
}
diff --git a/lib/src/command/run.dart b/lib/src/command/run.dart
index ad2a117..6f626c3 100644
--- a/lib/src/command/run.dart
+++ b/lib/src/command/run.dart
@@ -76,7 +76,7 @@
!entrypoint.packageGraph.isPackageMutable(package));
var exitCode = await runExecutable(entrypoint, package, executable, args,
- checked: argResults['enable-asserts'] || argResults['checked'],
+ enableAsserts: argResults['enable-asserts'] || argResults['checked'],
snapshotPath: useSnapshot ? snapshotPath : null, recompile: () {
final pkg = entrypoint.packageGraph.packages[package];
// The recompile function will only be called when [package] exists.
diff --git a/lib/src/executable.dart b/lib/src/executable.dart
index 1d8448e..720691c 100644
--- a/lib/src/executable.dart
+++ b/lib/src/executable.dart
@@ -22,7 +22,7 @@
///
/// Arguments from [args] will be passed to the spawned Dart application.
///
-/// If [checked] is true, the program is run with assertions enabled.
+/// If [enableAsserts] is true, the program is run with assertions enabled.
///
/// If [packagesFile] is passed, it's used as the package config file path for
/// the executable. Otherwise, `entrypoint.packagesFile` is used.
@@ -36,7 +36,7 @@
/// Returns the exit code of the spawned app.
Future<int> runExecutable(Entrypoint entrypoint, String package,
String executable, Iterable<String> args,
- {bool checked = false,
+ {bool enableAsserts = false,
String packagesFile,
String snapshotPath,
Future<void> Function() recompile}) async {
@@ -69,7 +69,9 @@
entrypoint.assertUpToDate();
var result = await _runOrCompileSnapshot(snapshotPath, args,
- packagesFile: packagesFile, checked: checked, recompile: recompile);
+ packagesFile: packagesFile,
+ enableAsserts: enableAsserts,
+ recompile: recompile);
if (result != null) return result;
}
@@ -96,7 +98,7 @@
var packageConfig = p.toUri(p.absolute(packagesFile));
await isolate.runUri(p.toUri(executablePath), args.toList(), null,
- checked: checked,
+ enableAsserts: enableAsserts,
automaticPackageResolution: packageConfig == null,
packageConfig: packageConfig);
return exitCode;
@@ -123,7 +125,7 @@
Future<int> _runOrCompileSnapshot(String path, Iterable<String> args,
{Future<void> Function() recompile,
String packagesFile,
- bool checked = false}) async {
+ bool enableAsserts = false}) async {
if (!fileExists(path)) {
if (recompile == null) return null;
await recompile();
@@ -131,7 +133,9 @@
}
return await _runSnapshot(path, args,
- recompile: recompile, packagesFile: packagesFile, checked: checked);
+ recompile: recompile,
+ packagesFile: packagesFile,
+ enableAsserts: enableAsserts);
}
/// Runs the snapshot at [path] with [args] and hooks its stdout, stderr, and
@@ -141,7 +145,7 @@
/// expected to regenerate a snapshot at [path], after which the snapshot will
/// be re-run.
///
-/// If [checked] is set, runs the snapshot with assertions enabled.
+/// If [enableAsserts] is set, runs the snapshot with assertions enabled.
///
/// Returns the snapshot's exit code.
///
@@ -149,7 +153,7 @@
Future<int> _runSnapshot(String path, Iterable<String> args,
{Future<void> Function() recompile,
String packagesFile,
- bool checked = false}) async {
+ bool enableAsserts = false}) async {
Uri packageConfig;
if (packagesFile != null) {
// We use an absolute path here not because the VM insists but because it's
@@ -163,7 +167,7 @@
var argList = args.toList();
try {
await isolate.runUri(url, argList, null,
- checked: checked,
+ enableAsserts: enableAsserts,
automaticPackageResolution: packageConfig == null,
packageConfig: packageConfig);
} on IsolateSpawnException catch (error) {
@@ -175,7 +179,7 @@
log.fine('Precompiled executable is out of date.');
await recompile();
await isolate.runUri(url, argList, null,
- checked: checked, packageConfig: packageConfig);
+ enableAsserts: enableAsserts, packageConfig: packageConfig);
}
return exitCode;
diff --git a/lib/src/global_packages.dart b/lib/src/global_packages.dart
index f17db39..2cb0b64 100644
--- a/lib/src/global_packages.dart
+++ b/lib/src/global_packages.dart
@@ -395,16 +395,16 @@
/// recompiled if the SDK has been upgraded since it was first compiled and
/// then run. Otherwise, it will be run from source.
///
- /// If [checked] is true, the program is run with assertions enabled.
+ /// If [enableAsserts] is true, the program is run with assertions enabled.
///
/// Returns the exit code from the executable.
Future<int> runExecutable(
String package, String executable, Iterable<String> args,
- {bool checked = false}) {
+ {bool enableAsserts = false}) {
var entrypoint = find(package);
return exe.runExecutable(
entrypoint, package, p.join('bin', '$executable.dart'), args,
- checked: checked,
+ enableAsserts: enableAsserts,
packagesFile:
entrypoint.isCached ? _getPackagesFilePath(package) : null,
// Don't use snapshots for executables activated from paths.
diff --git a/lib/src/isolate.dart b/lib/src/isolate.dart
index ed30f48..9d0a7aa 100644
--- a/lib/src/isolate.dart
+++ b/lib/src/isolate.dart
@@ -16,14 +16,14 @@
/// If [buffered] is `true`, this uses [spawnBufferedUri] to spawn the isolate.
Future runUri(Uri url, List<String> args, Object message,
{bool buffered = false,
- bool checked,
+ bool enableAsserts,
bool automaticPackageResolution = false,
Uri packageConfig}) async {
var errorPort = ReceivePort();
var exitPort = ReceivePort();
await Isolate.spawnUri(url, args, message,
- checked: checked,
+ checked: enableAsserts,
automaticPackageResolution: automaticPackageResolution,
packageConfig: packageConfig,
onError: errorPort.sendPort,