(opCode: IcuCreateOpCode, parentIdx: number, refIdx: number)
| 155 | } |
| 156 | |
| 157 | export function icuCreateOpCode(opCode: IcuCreateOpCode, parentIdx: number, refIdx: number) { |
| 158 | ngDevMode && assertGreaterThanOrEqual(parentIdx, 0, 'Missing parent index'); |
| 159 | ngDevMode && assertGreaterThan(refIdx, 0, 'Missing ref index'); |
| 160 | |
| 161 | // Note that we intentionally retain the error here in production, |
| 162 | // because the value can change based on the locale. |
| 163 | if (parentIdx > IcuCreateOpCode.MAX_PARENT || refIdx > IcuCreateOpCode.MAX_REF) { |
| 164 | throw new Error('ICU node index out of range (too many nodes in ICU case)'); |
| 165 | } |
| 166 | |
| 167 | return ( |
| 168 | opCode | (parentIdx << IcuCreateOpCode.SHIFT_PARENT) | (refIdx << IcuCreateOpCode.SHIFT_REF) |
| 169 | ); |
| 170 | } |
| 171 | |
| 172 | // Returns whether the given value corresponds to a root template message, |
| 173 | // or a sub-template. |
no test coverage detected