* Ingest the nodes of a template AST into the given `ViewCompilation`.
(unit: ViewCompilationUnit, template: t.Node[])
| 283 | * Ingest the nodes of a template AST into the given `ViewCompilation`. |
| 284 | */ |
| 285 | function ingestNodes(unit: ViewCompilationUnit, template: t.Node[]): void { |
| 286 | for (const node of template) { |
| 287 | if (node instanceof t.Element) { |
| 288 | ingestElement(unit, node); |
| 289 | } else if (node instanceof t.Template) { |
| 290 | ingestTemplate(unit, node); |
| 291 | } else if (node instanceof t.Content) { |
| 292 | ingestContent(unit, node); |
| 293 | } else if (node instanceof t.Text) { |
| 294 | ingestText(unit, node, null); |
| 295 | } else if (node instanceof t.BoundText) { |
| 296 | ingestBoundText(unit, node, null); |
| 297 | } else if (node instanceof t.IfBlock) { |
| 298 | ingestIfBlock(unit, node); |
| 299 | } else if (node instanceof t.SwitchBlock) { |
| 300 | ingestSwitchBlock(unit, node); |
| 301 | } else if (node instanceof t.DeferredBlock) { |
| 302 | ingestDeferBlock(unit, node); |
| 303 | } else if (node instanceof t.Icu) { |
| 304 | ingestIcu(unit, node); |
| 305 | } else if (node instanceof t.ForLoopBlock) { |
| 306 | ingestForBlock(unit, node); |
| 307 | } else if (node instanceof t.LetDeclaration) { |
| 308 | ingestLetDeclaration(unit, node); |
| 309 | } else if (node instanceof t.Component) { |
| 310 | // TODO(crisbeto): account for selectorless nodes. |
| 311 | } else { |
| 312 | throw new Error(`Unsupported template node: ${node.constructor.name}`); |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Ingest an element AST from the template into the given `ViewCompilation`. |
no test coverage detected