* Execute one hook against the current `LView`. * * @param currentView The current view * @param initPhaseState the current state of the init phase * @param arr The array in which the hooks are found * @param i The current index within the hook data array
(currentView: LView, initPhase: InitPhaseState, arr: HookData, i: number)
| 303 | * @param i The current index within the hook data array |
| 304 | */ |
| 305 | function callHook(currentView: LView, initPhase: InitPhaseState, arr: HookData, i: number) { |
| 306 | const isInitHook = (arr[i] as number) < 0; |
| 307 | const hook = arr[i + 1] as () => void; |
| 308 | const directiveIndex = isInitHook ? -arr[i] : (arr[i] as number); |
| 309 | const directive = currentView[directiveIndex]; |
| 310 | if (isInitHook) { |
| 311 | const indexWithintInitPhase = currentView[FLAGS] >> LViewFlags.IndexWithinInitPhaseShift; |
| 312 | // The init phase state must be always checked here as it may have been recursively updated. |
| 313 | if ( |
| 314 | indexWithintInitPhase < |
| 315 | currentView[PREORDER_HOOK_FLAGS] >> PreOrderHookFlags.NumberOfInitHooksCalledShift && |
| 316 | (currentView[FLAGS] & LViewFlags.InitPhaseStateMask) === initPhase |
| 317 | ) { |
| 318 | currentView[FLAGS] += LViewFlags.IndexWithinInitPhaseIncrementer; |
| 319 | callHookInternal(directive, hook); |
| 320 | } |
| 321 | } else { |
| 322 | callHookInternal(directive, hook); |
| 323 | } |
| 324 | } |
no test coverage detected
searching dependent graphs…