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

Function parseIcuCase

packages/core/src/render3/i18n/i18n_parse.ts:739–785  ·  view source on GitHub ↗

* Parses a node, its children and its siblings, and generates the mutate & update OpCodes. *

(
  ast: I18nNode[],
  tView: TView,
  tIcu: TIcu,
  lView: LView,
  updateOpCodes: I18nUpdateOpCodes,
  parentIdx: number,
  caseName: string,
  unsafeCaseHtml: string,
  nestedIcus: IcuExpression[],
)

Source from the content-addressed store, hash-verified

737 *
738 */
739function parseIcuCase(
740 ast: I18nNode[],
741 tView: TView,
742 tIcu: TIcu,
743 lView: LView,
744 updateOpCodes: I18nUpdateOpCodes,
745 parentIdx: number,
746 caseName: string,
747 unsafeCaseHtml: string,
748 nestedIcus: IcuExpression[],
749): number {
750 const create: IcuCreateOpCodes = [] as any;
751 const remove: I18nRemoveOpCodes = [] as any;
752 const update: I18nUpdateOpCodes = [] as any;
753 if (ngDevMode) {
754 attachDebugGetter(create, icuCreateOpCodesToString);
755 attachDebugGetter(remove, i18nRemoveOpCodesToString);
756 attachDebugGetter(update, i18nUpdateOpCodesToString);
757 }
758 tIcu.cases.push(caseName);
759 tIcu.create.push(create);
760 tIcu.remove.push(remove);
761 tIcu.update.push(update);
762
763 const inertBodyHelper = getInertBodyHelper(getDocument());
764 const inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeCaseHtml);
765 ngDevMode && assertDefined(inertBodyElement, 'Unable to generate inert body element');
766 const inertRootNode = (getTemplateContent(inertBodyElement!) as Element) || inertBodyElement;
767 if (inertRootNode) {
768 return walkIcuTree(
769 ast,
770 tView,
771 tIcu,
772 lView,
773 updateOpCodes,
774 create,
775 remove,
776 update,
777 inertRootNode,
778 parentIdx,
779 nestedIcus,
780 0,
781 );
782 } else {
783 return 0;
784 }
785}
786
787function walkIcuTree(
788 ast: I18nNode[],

Callers 1

icuStartFunction · 0.85

Calls 8

getInertBodyHelperFunction · 0.90
getDocumentFunction · 0.90
assertDefinedFunction · 0.90
getTemplateContentFunction · 0.90
attachDebugGetterFunction · 0.85
walkIcuTreeFunction · 0.85
pushMethod · 0.45
getInertBodyElementMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…