( unit: ViewCompilationUnit, suffix: string, i18nMeta: i18n.I18nMeta | undefined, children?: t.Node[], sourceSpan?: ParseSourceSpan, )
| 737 | } |
| 738 | |
| 739 | function ingestDeferView( |
| 740 | unit: ViewCompilationUnit, |
| 741 | suffix: string, |
| 742 | i18nMeta: i18n.I18nMeta | undefined, |
| 743 | children?: t.Node[], |
| 744 | sourceSpan?: ParseSourceSpan, |
| 745 | ): ir.TemplateOp | null { |
| 746 | if (i18nMeta !== undefined && !(i18nMeta instanceof i18n.BlockPlaceholder)) { |
| 747 | throw Error('Unhandled i18n metadata type for defer block'); |
| 748 | } |
| 749 | if (children === undefined) { |
| 750 | return null; |
| 751 | } |
| 752 | const secondaryView = unit.job.allocateView(unit.xref); |
| 753 | ingestNodes(secondaryView, children); |
| 754 | const templateOp = ir.createTemplateOp( |
| 755 | secondaryView.xref, |
| 756 | ir.TemplateKind.Block, |
| 757 | null, |
| 758 | `Defer${suffix}`, |
| 759 | ir.Namespace.HTML, |
| 760 | i18nMeta, |
| 761 | sourceSpan!, |
| 762 | sourceSpan!, |
| 763 | ); |
| 764 | unit.create.push(templateOp); |
| 765 | return templateOp; |
| 766 | } |
| 767 | |
| 768 | function ingestDeferBlock(unit: ViewCompilationUnit, deferBlock: t.DeferredBlock): void { |
| 769 | let ownResolverFn: o.Expression | null = null; |
no test coverage detected