MCPcopy Index your code
hub / github.com/angular/angular / registerHostBindingOpCodes

Function registerHostBindingOpCodes

packages/core/src/render3/view/directives.ts:485–509  ·  view source on GitHub ↗
(
  tView: TView,
  tNode: TNode,
  directiveIdx: number,
  directiveVarsIdx: number,
  def: ComponentDef<any> | DirectiveDef<any>,
)

Source from the content-addressed store, hash-verified

483 * @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
484 */
485export 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`

Callers 1

Calls 3

assertFirstCreatePassFunction · 0.90
lastSelectedElementIdxFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…