X Tutup
Skip to content

Commit 5c48236

Browse files
fix(lang): avoid infinite loop when calling assert()
The current code doesn't function properly: - assert are never activated - even if activated would result in infinite loop Since the code is broken and blocks other use-cases this commit turns assert into noop. A proper solution for asserts will be part of #2830 Fixes #4981 Closes #4983
1 parent c90e192 commit 5c48236

File tree

1 file changed

+2
-5
lines changed
  • modules/angular2/src/core/facade

1 file changed

+2
-5
lines changed

modules/angular2/src/core/facade/lang.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,15 @@ export function getTypeNameForDebugging(type: Type): string {
3737
export var Math = _global.Math;
3838
export var Date = _global.Date;
3939

40-
var assertionsEnabled_ = typeof _global['assert'] !== 'undefined';
4140
export function assertionsEnabled(): boolean {
42-
return assertionsEnabled_;
41+
return false;
4342
}
4443

4544
// TODO: remove calls to assert in production environment
4645
// Note: Can't just export this and import in in other files
4746
// as `assert` is a reserved keyword in Dart
4847
_global.assert = function assert(condition) {
49-
if (assertionsEnabled_) {
50-
_global['assert'].call(condition);
51-
}
48+
// TODO: to be fixed properly via #2830, noop for now
5249
};
5350

5451
// This function is needed only to properly support Dart's const expressions

0 commit comments

Comments
 (0)
X Tutup