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