feat(dart): Support forcing dev mode via enableDevMode in Dart.
Closes #5193
This commit is contained in:
parent
2645fb0d6c
commit
a8d9dbf110
|
@ -1 +0,0 @@
|
||||||
// Dart development mode is determined by checked mode.
|
|
|
@ -225,18 +225,27 @@ bool isJsObject(o) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _forceDevMode = false;
|
||||||
|
bool _devModeLocked = false;
|
||||||
|
|
||||||
void lockDevMode() {
|
void lockDevMode() {
|
||||||
// lockDevMode() has no effect in Dart.
|
_devModeLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableDevMode() {
|
void enableDevMode() {
|
||||||
// enableDevMode() has no effect in Dart.
|
if (_forceDevMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_devModeLocked) {
|
||||||
|
throw new Exception("Cannot enable dev mode after platform setup.");
|
||||||
|
}
|
||||||
|
_forceDevMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool assertionsEnabled() {
|
bool assertionsEnabled() {
|
||||||
var k = false;
|
var k = false;
|
||||||
assert((k = true));
|
assert((k = true));
|
||||||
return k;
|
return _forceDevMode || k;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't be all uppercase as our transpiler would think it is a special directive...
|
// Can't be all uppercase as our transpiler would think it is a special directive...
|
||||||
|
|
Loading…
Reference in New Issue