* Ingest the nodes of a template AST into the given `ViewCompilation`.
(unit: ViewCompilationUnit, template: t.Node[])
| 239 | * Ingest the nodes of a template AST into the given `ViewCompilation`. |
| 240 | */ |
| 241 | function ingestNodes(unit: ViewCompilationUnit, template: t.Node[]): void { |
| 242 | for (const node of template) { |
| 243 | if (node instanceof t.Element) { |
| 244 | ingestElement(unit, node); |
| 245 | } else if (node instanceof t.Template) { |
| 246 | ingestTemplate(unit, node); |
| 247 | } else if (node instanceof t.Content) { |
| 248 | ingestContent(unit, node); |
| 249 | } else if (node instanceof t.Text) { |
| 250 | ingestText(unit, node, null); |
| 251 | } else if (node instanceof t.BoundText) { |
| 252 | ingestBoundText(unit, node, null); |
| 253 | } else if (node instanceof t.IfBlock) { |
| 254 | ingestIfBlock(unit, node); |
| 255 | } else if (node instanceof t.SwitchBlock) { |
| 256 | ingestSwitchBlock(unit, node); |
| 257 | } else if (node instanceof t.DeferredBlock) { |
| 258 | ingestDeferBlock(unit, node); |
| 259 | } else if (node instanceof t.Icu) { |
| 260 | ingestIcu(unit, node); |
| 261 | } else if (node instanceof t.ForLoopBlock) { |
| 262 | ingestForBlock(unit, node); |
| 263 | } else if (node instanceof t.LetDeclaration) { |
| 264 | ingestLetDeclaration(unit, node); |
| 265 | } else if (node instanceof t.Component) { |
| 266 | // TODO(crisbeto): account for selectorless nodes. |
| 267 | } else { |
| 268 | throw new Error(`Unsupported template node: ${node.constructor.name}`); |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * Ingest an element AST from the template into the given `ViewCompilation`. |
no test coverage detected