* 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[], )
| 737 | * |
| 738 | */ |
| 739 | function 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 | |
| 787 | function walkIcuTree( |
| 788 | ast: I18nNode[], |
no test coverage detected
searching dependent graphs…