Caches local names and their matching directive indices for query and template lookups.
(
tNode: TNode,
localRefs: string[],
exportsMap: {[key: string]: number},
)
| 100 | |
| 101 | /** Caches local names and their matching directive indices for query and template lookups. */ |
| 102 | function 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: |
no test coverage detected
searching dependent graphs…