fix(ivy): support property values changed in ngOnChanges (forward rref case) (#29054)

PR Close #29054
This commit is contained in:
Marc Laval
2019-03-01 14:39:28 +01:00
committed by Andrew Kushnir
parent 6215799055
commit 25166d4f41
24 changed files with 609 additions and 114 deletions

View File

@ -45,8 +45,9 @@ export const CHILD_HEAD = 14;
export const CHILD_TAIL = 15;
export const CONTENT_QUERIES = 16;
export const DECLARATION_VIEW = 17;
export const PREORDER_HOOK_FLAGS = 18;
/** Size of LView's header. Necessary to adjust for it when setting slots. */
export const HEADER_OFFSET = 19;
export const HEADER_OFFSET = 20;
// This interface replaces the real LView interface if it is an arg or a
@ -215,6 +216,11 @@ export interface LView extends Array<any> {
* context.
*/
[DECLARATION_VIEW]: LView|null;
/**
* More flags for this view. See PreOrderHookFlags for more info.
*/
[PREORDER_HOOK_FLAGS]: PreOrderHookFlags;
}
/** Flags associated with an LView (saved in LView[FLAGS]) */
@ -296,6 +302,20 @@ export const enum InitPhaseState {
InitPhaseCompleted = 0b11,
}
/** More flags associated with an LView (saved in LView[FLAGS_MORE]) */
export const enum PreOrderHookFlags {
/** The index of the next pre-order hook to be called in the hooks array, on the first 16
bits */
IndexOfTheNextPreOrderHookMaskMask = 0b01111111111111111,
/**
* The number of init hooks that have already been called, on the last 16 bits
*/
NumberOfInitHooksCalledIncrementer = 0b010000000000000000,
NumberOfInitHooksCalledShift = 16,
NumberOfInitHooksCalledMask = 0b11111111111111110000000000000000,
}
/**
* Set of instructions used to process host bindings efficiently.
*
@ -438,21 +458,21 @@ export interface TView {
pipeRegistry: PipeDefList|null;
/**
* Array of ngOnInit and ngDoCheck hooks that should be executed for this view in
* Array of ngOnInit, ngOnChanges and ngDoCheck hooks that should be executed for this view in
* creation mode.
*
* Even indices: Directive index
* Odd indices: Hook function
*/
initHooks: HookData|null;
preOrderHooks: HookData|null;
/**
* Array of ngDoCheck hooks that should be executed for this view in update mode.
* Array of ngOnChanges and ngDoCheck hooks that should be executed for this view in update mode.
*
* Even indices: Directive index
* Odd indices: Hook function
*/
checkHooks: HookData|null;
preOrderCheckHooks: HookData|null;
/**
* Array of ngAfterContentInit and ngAfterContentChecked hooks that should be executed
@ -591,8 +611,14 @@ export interface RootContext {
/**
* Array of hooks that should be executed for a view and their directive indices.
*
* Even indices: Directive index
* Odd indices: Hook function
* For each node of the view, the following data is stored:
* 1) Node index (optional)
* 2) A series of number/function pairs where:
* - even indices are directive indices
* - odd indices are hook functions
*
* Special cases:
* - a negative directive index flags an init hook (ngOnInit, ngAfterContentInit, ngAfterViewInit)
*/
export type HookData = (number | (() => void))[];