MCPcopy Create free account
hub / github.com/angular/angular / icuCreateOpCode

Function icuCreateOpCode

packages/core/src/render3/i18n/i18n_util.ts:157–170  ·  view source on GitHub ↗
(opCode: IcuCreateOpCode, parentIdx: number, refIdx: number)

Source from the content-addressed store, hash-verified

155}
156
157export 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.

Callers 1

addCreateNodeAndAppendFunction · 0.90

Calls 2

assertGreaterThanOrEqualFunction · 0.90
assertGreaterThanFunction · 0.90

Tested by

no test coverage detected