( tView: TView, index: number, type: TNodeType, name: string | null, attrs: TAttributes | null, )
| 147 | } |
| 148 | |
| 149 | export function createTNodeAtIndex( |
| 150 | tView: TView, |
| 151 | index: number, |
| 152 | type: TNodeType, |
| 153 | name: string | null, |
| 154 | attrs: TAttributes | null, |
| 155 | ) { |
| 156 | const currentTNode = getCurrentTNodePlaceholderOk(); |
| 157 | const isParent = isCurrentTNodeParent(); |
| 158 | const parent = isParent ? currentTNode : currentTNode && currentTNode.parent; |
| 159 | |
| 160 | // Parents cannot cross component boundaries because components will be used in multiple places. |
| 161 | const tNode = (tView.data[index] = createTNode( |
| 162 | tView, |
| 163 | parent as TElementNode | TContainerNode, |
| 164 | type, |
| 165 | index, |
| 166 | name, |
| 167 | attrs, |
| 168 | )); |
| 169 | |
| 170 | // Assign a pointer to the first child node of a given view. The first node is not always the one |
| 171 | // at index 0, in case of i18n, index 0 can be the instruction `i18nStart` and the first node has |
| 172 | // the index 1 or more, so we can't just check node index. |
| 173 | linkTNodeInTView(tView, tNode, currentTNode, isParent); |
| 174 | |
| 175 | return tNode; |
| 176 | } |
| 177 | |
| 178 | function linkTNodeInTView( |
| 179 | tView: TView, |
no test coverage detected
searching dependent graphs…