MCPcopy Index your code
hub / github.com/angular/angular / applyIcuSwitchCaseRemove

Function applyIcuSwitchCaseRemove

packages/core/src/render3/i18n/i18n_apply.ts:558–574  ·  view source on GitHub ↗

* Apply OpCodes associated with tearing ICU case. * * This involves tearing down existing case and than building up a new case. * * @param tView Current `TView` * @param tIcu Current `TIcu` * @param lView Current `LView`

(tView: TView, tIcu: TIcu, lView: LView)

Source from the content-addressed store, hash-verified

556 * @param lView Current `LView`
557 */
558function applyIcuSwitchCaseRemove(tView: TView, tIcu: TIcu, lView: LView) {
559 let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
560 if (activeCaseIndex !== null) {
561 const removeCodes = tIcu.remove[activeCaseIndex];
562 for (let i = 0; i < removeCodes.length; i++) {
563 const nodeOrIcuIndex = removeCodes[i] as number;
564 if (nodeOrIcuIndex > 0) {
565 // Positive numbers are `RNode`s.
566 const rNode = getNativeByIndex(nodeOrIcuIndex, lView);
567 rNode !== null && nativeRemoveNode(lView[RENDERER], rNode);
568 } else {
569 // Negative numbers are ICUs
570 applyIcuSwitchCaseRemove(tView, getTIcu(tView, ~nodeOrIcuIndex)!, lView);
571 }
572 }
573 }
574}
575
576/**
577 * Returns the index of the current case of an ICU expression depending on the main binding value

Callers 1

applyIcuSwitchCaseFunction · 0.85

Calls 4

getCurrentICUCaseIndexFunction · 0.90
getNativeByIndexFunction · 0.90
nativeRemoveNodeFunction · 0.90
getTIcuFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…