* Apply `I18nUpdateOpCodes` OpCodes * * @param tView Current `TView` * @param lView Current `LView` * @param updateOpCodes OpCodes to process * @param bindingsStartIndex Location of the first `ɵɵi18nApply` * @param changeMask Each bit corresponds to a `ɵɵi18nExp` (Counting backwards from *
( tView: TView, lView: LView, updateOpCodes: I18nUpdateOpCodes, bindingsStartIndex: number, changeMask: number, )
| 400 | * `bindingsStartIndex`) |
| 401 | */ |
| 402 | function applyUpdateOpCodes( |
| 403 | tView: TView, |
| 404 | lView: LView, |
| 405 | updateOpCodes: I18nUpdateOpCodes, |
| 406 | bindingsStartIndex: number, |
| 407 | changeMask: number, |
| 408 | ) { |
| 409 | for (let i = 0; i < updateOpCodes.length; i++) { |
| 410 | // bit code to check if we should apply the next update |
| 411 | const checkBit = updateOpCodes[i] as number; |
| 412 | // Number of opCodes to skip until next set of update codes |
| 413 | const skipCodes = updateOpCodes[++i] as number; |
| 414 | if (checkBit & changeMask) { |
| 415 | // The value has been updated since last checked |
| 416 | let value = ''; |
| 417 | for (let j = i + 1; j <= i + skipCodes; j++) { |
| 418 | const opCode = updateOpCodes[j]; |
| 419 | if (typeof opCode == 'string') { |
| 420 | value += opCode; |
| 421 | } else if (typeof opCode == 'number') { |
| 422 | if (opCode < 0) { |
| 423 | // Negative opCode represent `i18nExp` values offset. |
| 424 | value += renderStringify(lView[bindingsStartIndex - opCode]); |
| 425 | } else { |
| 426 | const nodeIndex = opCode >>> I18nUpdateOpCode.SHIFT_REF; |
| 427 | switch (opCode & I18nUpdateOpCode.MASK_OPCODE) { |
| 428 | case I18nUpdateOpCode.Attr: |
| 429 | const propName = updateOpCodes[++j] as string; |
| 430 | const sanitizeFn = updateOpCodes[++j] as SanitizerFn | null; |
| 431 | const tNodeOrTagName = tView.data[nodeIndex] as TNode | string; |
| 432 | ngDevMode && assertDefined(tNodeOrTagName, 'Experting TNode or string'); |
| 433 | if (typeof tNodeOrTagName === 'string') { |
| 434 | // IF we don't have a `TNode`, then we are an element in ICU (as ICU content does |
| 435 | // not have TNode), in which case we know that there are no directives, and hence |
| 436 | // we use attribute setting. |
| 437 | setElementAttribute( |
| 438 | lView[RENDERER], |
| 439 | lView[nodeIndex], |
| 440 | null, |
| 441 | tNodeOrTagName, |
| 442 | propName, |
| 443 | value, |
| 444 | sanitizeFn, |
| 445 | ); |
| 446 | } else { |
| 447 | const prevSelectedIndex = getSelectedIndex(); |
| 448 | setSelectedIndex(nodeIndex); |
| 449 | try { |
| 450 | setPropertyAndInputs( |
| 451 | tNodeOrTagName, |
| 452 | lView, |
| 453 | propName, |
| 454 | value, |
| 455 | lView[RENDERER], |
| 456 | sanitizeFn, |
| 457 | ); |
| 458 | } finally { |
| 459 | setSelectedIndex(prevSelectedIndex); |
no test coverage detected
searching dependent graphs…