feat(dart): Support forcing dev mode via enableDevMode in Dart.

Closes #5193
This commit is contained in:
Alex Rickabaugh 2015-11-08 21:56:52 -08:00
parent 2645fb0d6c
commit a8d9dbf110
2 changed files with 12 additions and 4 deletions

View File

@ -1 +0,0 @@
// Dart development mode is determined by checked mode.

View File

@ -225,18 +225,27 @@ bool isJsObject(o) {
return false;
}
bool _forceDevMode = false;
bool _devModeLocked = false;
void lockDevMode() {
// lockDevMode() has no effect in Dart.
_devModeLocked = true;
}
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() {
var k = false;
assert((k = true));
return k;
return _forceDevMode || k;
}
// Can't be all uppercase as our transpiler would think it is a special directive...