refactor(ivy): move dir flags to tnode (#22901)

PR Close #22901
This commit is contained in:
Kara Erickson
2018-03-20 19:06:49 -07:00
committed by Matias Niemelä
parent 99711b12f9
commit e44f69c387
12 changed files with 150 additions and 155 deletions

View File

@ -7,7 +7,7 @@
*/
import {DirectiveDef} from './interfaces/definition';
import {LNodeFlags} from './interfaces/node';
import {TNodeFlags} from './interfaces/node';
import {HookData, LView, LifecycleStage, TView} from './interfaces/view';
/**
@ -43,13 +43,13 @@ export function queueInitHooks(
export function queueLifecycleHooks(flags: number, currentView: LView): void {
const tView = currentView.tView;
if (tView.firstTemplatePass === true) {
const size = (flags & LNodeFlags.SIZE_MASK) >> LNodeFlags.SIZE_SHIFT;
const start = flags >> LNodeFlags.INDX_SHIFT;
const start = flags >> TNodeFlags.INDX_SHIFT;
const end = start + (flags & TNodeFlags.SIZE_MASK);
// It's necessary to loop through the directives at elementEnd() (rather than processing in
// directiveCreate) so we can preserve the current hook order. Content, view, and destroy
// hooks for projected components and directives must be called *before* their hosts.
for (let i = start, end = start + size; i < end; i++) {
for (let i = start; i < end; i++) {
const def = (tView.data[i] as DirectiveDef<any>);
queueContentHooks(def, tView, i);
queueViewHooks(def, tView, i);