Skip to content

Commit 08922e1

Browse files
authored
Rename dart-non-checked-mode: disable-dart-asserts (flutter#6977)
In Dart 2, runtime checked mode has been eliminated. Many of these type checks have been moved to static compile-time checks, the remainder are enforced at runtime, and are no longer optional.
1 parent be36ba6 commit 08922e1

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

common/settings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ std::string Settings::ToString() const {
3535
stream << "trace_startup: " << trace_startup << std::endl;
3636
stream << "endless_trace_buffer: " << endless_trace_buffer << std::endl;
3737
stream << "enable_dart_profiling: " << enable_dart_profiling << std::endl;
38-
stream << "dart_non_checked_mode: " << dart_non_checked_mode << std::endl;
38+
stream << "disable_dart_asserts: " << disable_dart_asserts << std::endl;
3939
stream << "enable_observatory: " << enable_observatory << std::endl;
4040
stream << "observatory_port: " << observatory_port << std::endl;
4141
stream << "ipv6: " << ipv6 << std::endl;

common/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct Settings {
4747
bool trace_startup = false;
4848
bool endless_trace_buffer = false;
4949
bool enable_dart_profiling = false;
50-
bool dart_non_checked_mode = false;
50+
bool disable_dart_asserts = false;
5151
// Used as the script URI in debug messages. Does not affect how the Dart code
5252
// is executed.
5353
std::string advisory_script_uri = "main.dart";

runtime/dart_vm.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,18 +325,18 @@ DartVM::DartVM(const Settings& settings,
325325
arraysize(kDartPrecompilationArgs));
326326
}
327327

328-
// Enable checked mode if we are not running precompiled code. We run non-
328+
// Enable Dart assertions if we are not running precompiled code. We run non-
329329
// precompiled code only in the debug product mode.
330-
bool use_checked_mode = !settings.dart_non_checked_mode;
330+
bool enable_asserts = !settings.disable_dart_asserts;
331331

332332
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \
333333
FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
334-
use_checked_mode = false;
334+
enable_asserts = false;
335335
#endif
336336

337337
#if !OS_FUCHSIA
338338
if (IsRunningPrecompiledCode()) {
339-
use_checked_mode = false;
339+
enable_asserts = false;
340340
}
341341
#endif // !OS_FUCHSIA
342342

@@ -347,7 +347,7 @@ DartVM::DartVM(const Settings& settings,
347347
arraysize(kDartWriteProtectCodeArgs));
348348
#endif
349349

350-
if (use_checked_mode) {
350+
if (enable_asserts) {
351351
PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
352352
}
353353

shell/common/switches.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
139139
}
140140

141141
// Checked mode overrides.
142-
settings.dart_non_checked_mode =
143-
command_line.HasOption(FlagForSwitch(Switch::DartNonCheckedMode));
142+
settings.disable_dart_asserts =
143+
command_line.HasOption(FlagForSwitch(Switch::DisableDartAsserts));
144144

145145
settings.ipv6 = command_line.HasOption(FlagForSwitch(Switch::IPv6));
146146

shell/common/switches.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ DEF_SWITCH(RunForever,
120120
"run-forever",
121121
"In non-interactive mode, keep the shell running after the Dart "
122122
"script has completed.")
123-
DEF_SWITCH(DartNonCheckedMode,
124-
"dart-non-checked-mode",
125-
"Dart code runs in checked mode when the runtime mode is debug. In "
126-
"profile and release product modes, the application code is "
127-
"precompiled and checked mode is unsupported. However, this flag "
128-
"may be specified if the user wishes to run in the debug product "
129-
"mode (i.e. with JIT or DBC) with checked mode off.")
123+
DEF_SWITCH(DisableDartAsserts,
124+
"disable-dart-asserts",
125+
"Dart code runs with assertions enabled when the runtime mode is "
126+
"debug. In profile and release product modes, assertions are "
127+
"disabled. This flag may be specified if the user wishes to run "
128+
"with assertions disabled in the debug product mode (i.e. with JIT "
129+
"or DBC).")
130130
DEF_SWITCHES_END
131131

132132
void PrintUsage(const std::string& executable_name);

0 commit comments

Comments
 (0)