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

Function parseIcuCase

packages/core/src/render3/i18n/i18n_parse.ts:752–798  ·  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

750 *
751 */
752function parseIcuCase(
753 ast: I18nNode[],
754 tView: TView,
755 tIcu: TIcu,
756 lView: LView,
757 updateOpCodes: I18nUpdateOpCodes,
758 parentIdx: number,
759 caseName: string,
760 unsafeCaseHtml: string,
761 nestedIcus: IcuExpression[],
762): number {
763 const create: IcuCreateOpCodes = [] as any;
764 const remove: I18nRemoveOpCodes = [] as any;
765 const update: I18nUpdateOpCodes = [] as any;
766 if (ngDevMode) {
767 attachDebugGetter(create, icuCreateOpCodesToString);
768 attachDebugGetter(remove, i18nRemoveOpCodesToString);
769 attachDebugGetter(update, i18nUpdateOpCodesToString);
770 }
771 tIcu.cases.push(caseName);
772 tIcu.create.push(create);
773 tIcu.remove.push(remove);
774 tIcu.update.push(update);
775
776 const inertBodyHelper = getInertBodyHelper(getDocument());
777 const inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeCaseHtml);
778 ngDevMode && assertDefined(inertBodyElement, 'Unable to generate inert body element');
779 const inertRootNode = (getTemplateContent(inertBodyElement!) as Element) || inertBodyElement;
780 if (inertRootNode) {
781 return walkIcuTree(
782 ast,
783 tView,
784 tIcu,
785 lView,
786 updateOpCodes,
787 create,
788 remove,
789 update,
790 inertRootNode,
791 parentIdx,
792 nestedIcus,
793 0,
794 );
795 } else {
796 return 0;
797 }
798}
799
800function walkIcuTree(
801 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