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

Function createTNodeAtIndex

packages/core/src/render3/tnode_manipulation.ts:149–176  ·  view source on GitHub ↗
(
  tView: TView,
  index: number,
  type: TNodeType,
  name: string | null,
  attrs: TAttributes | null,
)

Source from the content-addressed store, hash-verified

147}
148
149export 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
178function linkTNodeInTView(
179 tView: TView,

Callers 3

createTNodePlaceholderFunction · 0.90
createTNodeAndAddOpCodeFunction · 0.90
getOrCreateTNodeFunction · 0.85

Calls 4

isCurrentTNodeParentFunction · 0.90
createTNodeFunction · 0.85
linkTNodeInTViewFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…