( tView: TView, tNode: TNode, directiveIdx: number, directiveVarsIdx: number, def: ComponentDef<any> | DirectiveDef<any>, )
| 483 | * @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add. |
| 484 | */ |
| 485 | export function registerHostBindingOpCodes( |
| 486 | tView: TView, |
| 487 | tNode: TNode, |
| 488 | directiveIdx: number, |
| 489 | directiveVarsIdx: number, |
| 490 | def: ComponentDef<any> | DirectiveDef<any>, |
| 491 | ): void { |
| 492 | ngDevMode && assertFirstCreatePass(tView); |
| 493 | |
| 494 | const hostBindings = def.hostBindings; |
| 495 | if (hostBindings) { |
| 496 | let hostBindingOpCodes = tView.hostBindingOpCodes; |
| 497 | if (hostBindingOpCodes === null) { |
| 498 | hostBindingOpCodes = tView.hostBindingOpCodes = [] as any as HostBindingOpCodes; |
| 499 | } |
| 500 | const elementIndx = ~tNode.index; |
| 501 | if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) { |
| 502 | // Conditionally add select element so that we are more efficient in execution. |
| 503 | // NOTE: this is strictly not necessary and it trades code size for runtime perf. |
| 504 | // (We could just always add it.) |
| 505 | hostBindingOpCodes.push(elementIndx); |
| 506 | } |
| 507 | hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings); |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | /** |
| 512 | * Returns the last selected element index in the `HostBindingOpCodes` |
no test coverage detected
searching dependent graphs…