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

Function resolveDirectives

packages/core/src/render3/view/directives.ts:58–99  ·  view source on GitHub ↗
(
  tView: TView,
  lView: LView,
  tNode: TElementNode | TContainerNode | TElementContainerNode,
  localRefs: string[] | null,
  directiveMatcher: DirectiveMatcherStrategy,
)

Source from the content-addressed store, hash-verified

56 * Resolve the matched directives on a node.
57 */
58export function resolveDirectives(
59 tView: TView,
60 lView: LView,
61 tNode: TElementNode | TContainerNode | TElementContainerNode,
62 localRefs: string[] | null,
63 directiveMatcher: DirectiveMatcherStrategy,
64): void {
65 // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in tsickle.
66 ngDevMode && assertFirstCreatePass(tView);
67
68 const exportsMap: Record<string, number> | null = localRefs === null ? null : {'': -1};
69 const matchedDirectiveDefs = directiveMatcher(tView, tNode);
70
71 if (matchedDirectiveDefs !== null) {
72 let directiveDefs = matchedDirectiveDefs;
73 let hostDirectiveDefs: HostDirectiveDefs | null = null;
74 let hostDirectiveRanges: HostDirectiveRanges | null = null;
75
76 for (const def of matchedDirectiveDefs) {
77 if (def.resolveHostDirectives !== null) {
78 [directiveDefs, hostDirectiveDefs, hostDirectiveRanges] =
79 def.resolveHostDirectives(matchedDirectiveDefs);
80 break;
81 }
82 }
83
84 ngDevMode && assertNoDuplicateDirectives(directiveDefs);
85
86 initializeDirectives(
87 tView,
88 lView,
89 tNode,
90 directiveDefs,
91 exportsMap,
92 hostDirectiveDefs,
93 hostDirectiveRanges,
94 );
95 }
96 if (exportsMap !== null && localRefs !== null) {
97 cacheMatchingLocalNames(tNode, localRefs, exportsMap);
98 }
99}
100
101/** Caches local names and their matching directive indices for query and template lookups. */
102function cacheMatchingLocalNames(

Callers 2

Calls 4

assertFirstCreatePassFunction · 0.90
initializeDirectivesFunction · 0.85
cacheMatchingLocalNamesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…