(tView: TView, index: number)
| 45 | * @param index Index where the value should be read from. |
| 46 | */ |
| 47 | export function getTIcu(tView: TView, index: number): TIcu | null { |
| 48 | const value = tView.data[index] as null | TIcu | TIcuContainerNode | string; |
| 49 | if (value === null || typeof value === 'string') return null; |
| 50 | if ( |
| 51 | ngDevMode && |
| 52 | !(Object.hasOwn(value, TVIEW) || Object.hasOwn(value, CURRENT_CASE_LVIEW_INDEX)) |
| 53 | ) { |
| 54 | throwError("We expect to get 'null'|'TIcu'|'TIcuContainer', but got: " + value); |
| 55 | } |
| 56 | // Here the `Object.hasOwn(value, CURRENT_CASE_LVIEW_INDEX)` is a polymorphic read as it can be |
| 57 | // either TIcu or TIcuContainerNode. This is not ideal, but we still think it is OK because it |
| 58 | // will be just two cases which fits into the browser inline cache (inline cache can take up to |
| 59 | // 4) |
| 60 | const tIcu = Object.hasOwn(value, CURRENT_CASE_LVIEW_INDEX) |
| 61 | ? (value as TIcu) |
| 62 | : (value as TIcuContainerNode).value; |
| 63 | ngDevMode && assertTIcu(tIcu); |
| 64 | return tIcu; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Store `TIcu` at a give `index`. |
no test coverage detected