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

Function allocExpando

packages/core/src/render3/view/construction.ts:282–307  ·  view source on GitHub ↗
(
  tView: TView,
  lView: LView,
  numSlotsToAlloc: number,
  initialValue: unknown,
)

Source from the content-addressed store, hash-verified

280 * @param initialValue Initial value to store in blueprint
281 */
282export function allocExpando(
283 tView: TView,
284 lView: LView,
285 numSlotsToAlloc: number,
286 initialValue: unknown,
287): number {
288 if (numSlotsToAlloc === 0) return -1;
289 if (ngDevMode) {
290 assertFirstCreatePass(tView);
291 assertSame(tView, lView[TVIEW], '`LView` must be associated with `TView`!');
292 assertEqual(tView.data.length, lView.length, 'Expecting LView to be same size as TView');
293 assertEqual(
294 tView.data.length,
295 tView.blueprint.length,
296 'Expecting Blueprint to be same size as TView',
297 );
298 assertFirstUpdatePass(tView);
299 }
300 const allocIdx = lView.length;
301 for (let i = 0; i < numSlotsToAlloc; i++) {
302 lView.push(initialValue);
303 tView.blueprint.push(initialValue);
304 tView.data.push(null);
305 }
306 return allocIdx;
307}
308
309/**
310 * Adds LView or LContainer to the end of the current view tree.

Callers 5

createTNodeAndAddOpCodeFunction · 0.90
icuStartFunction · 0.90
walkIcuTreeFunction · 0.90
initializeDirectivesFunction · 0.90

Calls 5

assertFirstCreatePassFunction · 0.90
assertSameFunction · 0.90
assertEqualFunction · 0.90
assertFirstUpdatePassFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…