( tView: TView, lView: LView, numSlotsToAlloc: number, initialValue: unknown, )
| 280 | * @param initialValue Initial value to store in blueprint |
| 281 | */ |
| 282 | export 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. |
no test coverage detected
searching dependent graphs…