( tView: TView, lView: LView, tNode: TElementNode | TContainerNode | TElementContainerNode, localRefs: string[] | null, directiveMatcher: DirectiveMatcherStrategy, )
| 56 | * Resolve the matched directives on a node. |
| 57 | */ |
| 58 | export 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. */ |
| 102 | function cacheMatchingLocalNames( |
no test coverage detected
searching dependent graphs…