perf: Don’t subclass Error; resulting in smaller binary (#14160)
Subclassing errors is problematic since Error returns a new instance. All of the patching which we do than prevent proper application of source maps. PR Close #14160
This commit is contained in:

committed by
Miško Hevery

parent
3c2842be96
commit
c33fda2607
@ -8,7 +8,7 @@
|
||||
|
||||
import {ComponentFactory, ComponentRef, ElementRef, Injector, TemplateRef, ViewContainerRef, ViewRef} from '@angular/core';
|
||||
import {devModeEqual, looseIdentical} from '@angular/core/src/change_detection/change_detection_util';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedError} from '@angular/core/src/linker/errors';
|
||||
import {expressionChangedAfterItHasBeenCheckedError} from '@angular/core/src/linker/errors';
|
||||
|
||||
|
||||
export function unimplemented(): any {
|
||||
@ -212,10 +212,10 @@ export function createAnchorAndAppend(parent: any) {
|
||||
export function checkBinding(throwOnChange: boolean, oldValue: any, newValue: any): boolean {
|
||||
if (throwOnChange) {
|
||||
if (!devModeEqual(oldValue, newValue)) {
|
||||
throw new ExpressionChangedAfterItHasBeenCheckedError(oldValue, newValue, false);
|
||||
throw expressionChangedAfterItHasBeenCheckedError(oldValue, newValue, false);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return !looseIdentical(oldValue, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {devModeEqual, looseIdentical} from '@angular/core/src/change_detection/change_detection_util';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedError} from '@angular/core/src/linker/errors';
|
||||
import {expressionChangedAfterItHasBeenCheckedError} from '@angular/core/src/linker/errors';
|
||||
|
||||
export function createElementAndAppend(parent: any, name: string) {
|
||||
const el = document.createElement(name);
|
||||
@ -29,10 +29,10 @@ export function createAnchorAndAppend(parent: any) {
|
||||
export function checkBinding(throwOnChange: boolean, oldValue: any, newValue: any): boolean {
|
||||
if (throwOnChange) {
|
||||
if (!devModeEqual(oldValue, newValue)) {
|
||||
throw new ExpressionChangedAfterItHasBeenCheckedError(oldValue, newValue, false);
|
||||
throw expressionChangedAfterItHasBeenCheckedError(oldValue, newValue, false);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return !looseIdentical(oldValue, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user