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

Function cacheMatchingLocalNames

packages/core/src/render3/view/directives.ts:102–121  ·  view source on GitHub ↗

Caches local names and their matching directive indices for query and template lookups.

(
  tNode: TNode,
  localRefs: string[],
  exportsMap: {[key: string]: number},
)

Source from the content-addressed store, hash-verified

100
101/** Caches local names and their matching directive indices for query and template lookups. */
102function cacheMatchingLocalNames(
103 tNode: TNode,
104 localRefs: string[],
105 exportsMap: {[key: string]: number},
106): void {
107 const localNames: (string | number)[] = (tNode.localNames = []);
108
109 // Local names must be stored in tNode in the same order that localRefs are defined
110 // in the template to ensure the data is loaded in the same slots as their refs
111 // in the template (for template queries).
112 for (let i = 0; i < localRefs.length; i += 2) {
113 const index = exportsMap[localRefs[i + 1]];
114 if (index == null)
115 throw new RuntimeError(
116 RuntimeErrorCode.EXPORT_NOT_FOUND,
117 ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`,
118 );
119 localNames.push(localRefs[i], index);
120 }
121}
122
123/**
124 * Marks a given TNode as a component's host. This consists of:

Callers 1

resolveDirectivesFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…