refactor(compiler): inline view.viewChildren in generated code

This commit is contained in:
Tobias Bosch
2016-10-31 10:10:13 -07:00
committed by vsavkin
parent 97471d74b6
commit e5fdf4c70a
5 changed files with 36 additions and 32 deletions

View File

@ -34,7 +34,6 @@ export abstract class AppView<T> {
allNodes: any[];
disposables: Function[];
contentChildren: AppView<any>[] = [];
viewChildren: AppView<any>[] = [];
viewContainerElement: AppElement = null;
numberOfChecks: number = 0;
@ -102,9 +101,6 @@ export abstract class AppView<T> {
this.allNodes = allNodes;
this.disposables = disposables;
if (this.type === ViewType.COMPONENT) {
// Note: the render nodes have been attached to their host element
// in the ViewFactory already.
this.declarationAppElement.parentView.viewChildren.push(this);
this.dirtyParentQueriesInternal();
}
}
@ -145,10 +141,6 @@ export abstract class AppView<T> {
for (var i = 0; i < children.length; i++) {
children[i]._destroyRecurse();
}
children = this.viewChildren;
for (var i = 0; i < children.length; i++) {
children[i]._destroyRecurse();
}
this.destroyLocal();
this.cdMode = ChangeDetectorStatus.Destroyed;
@ -214,7 +206,8 @@ export abstract class AppView<T> {
detectChanges(throwOnChange: boolean): void {
var s = _scope_check(this.clazz);
if (this.cdMode === ChangeDetectorStatus.Checked ||
this.cdMode === ChangeDetectorStatus.Errored)
this.cdMode === ChangeDetectorStatus.Errored ||
this.cdMode === ChangeDetectorStatus.Detached)
return;
if (this.cdMode === ChangeDetectorStatus.Destroyed) {
this.throwDestroyedError('detectChanges');
@ -231,7 +224,6 @@ export abstract class AppView<T> {
*/
detectChangesInternal(throwOnChange: boolean): void {
this.detectContentChildrenChanges(throwOnChange);
this.detectViewChildrenChanges(throwOnChange);
}
detectContentChildrenChanges(throwOnChange: boolean) {
@ -242,14 +234,6 @@ export abstract class AppView<T> {
}
}
detectViewChildrenChanges(throwOnChange: boolean) {
for (var i = 0; i < this.viewChildren.length; ++i) {
var child = this.viewChildren[i];
if (child.cdMode === ChangeDetectorStatus.Detached) continue;
child.detectChanges(throwOnChange);
}
}
markContentChildAsMoved(renderAppElement: AppElement): void { this.dirtyParentQueriesInternal(); }
addToContentChildren(renderAppElement: AppElement): void {