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

Function applyIcuSwitchCase

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

* Apply OpCodes associated with switching a case on ICU. * * 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` * @param value Value of the case to update to.

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

Source from the content-addressed store, hash-verified

528 * @param value Value of the case to update to.
529 */
530function applyIcuSwitchCase(tView: TView, tIcu: TIcu, lView: LView, value: string) {
531 // Rebuild a new case for this ICU
532 const caseIndex = getCaseIndex(tIcu, value);
533 let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
534 if (activeCaseIndex !== caseIndex) {
535 applyIcuSwitchCaseRemove(tView, tIcu, lView);
536 lView[tIcu.currentCaseLViewIndex] = caseIndex === null ? null : ~caseIndex;
537 if (caseIndex !== null) {
538 // Add the nodes for the new case
539 const anchorRNode = lView[tIcu.anchorIdx];
540 if (anchorRNode) {
541 ngDevMode && assertDomNode(anchorRNode);
542 applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, anchorRNode);
543 }
544 claimDehydratedIcuCase(lView, tIcu.anchorIdx, caseIndex);
545 }
546 }
547}
548
549/**
550 * Apply OpCodes associated with tearing ICU case.

Callers 1

applyUpdateOpCodesFunction · 0.85

Calls 6

getCurrentICUCaseIndexFunction · 0.90
assertDomNodeFunction · 0.90
claimDehydratedIcuCaseFunction · 0.90
getCaseIndexFunction · 0.85
applyIcuSwitchCaseRemoveFunction · 0.85
applyMutableOpCodesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…