From a8d9dbf110496075617b956654894cf3e7f0d190 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Sun, 8 Nov 2015 21:56:52 -0800 Subject: [PATCH] feat(dart): Support forcing dev mode via enableDevMode in Dart. Closes #5193 --- modules/angular2/src/core/dev_mode.dart | 1 - modules/angular2/src/facade/lang.dart | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) delete mode 100644 modules/angular2/src/core/dev_mode.dart diff --git a/modules/angular2/src/core/dev_mode.dart b/modules/angular2/src/core/dev_mode.dart deleted file mode 100644 index ad6c2091ea..0000000000 --- a/modules/angular2/src/core/dev_mode.dart +++ /dev/null @@ -1 +0,0 @@ -// Dart development mode is determined by checked mode. \ No newline at end of file diff --git a/modules/angular2/src/facade/lang.dart b/modules/angular2/src/facade/lang.dart index ba3c5c71ba..3353bfddbd 100644 --- a/modules/angular2/src/facade/lang.dart +++ b/modules/angular2/src/facade/lang.dart @@ -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...