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

Function ingestNodes

packages/compiler/src/template/pipeline/src/ingest.ts:285–315  ·  view source on GitHub ↗

* Ingest the nodes of a template AST into the given `ViewCompilation`.

(unit: ViewCompilationUnit, template: t.Node[])

Source from the content-addressed store, hash-verified

283 * Ingest the nodes of a template AST into the given `ViewCompilation`.
284 */
285function 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`.

Callers 9

ingestComponentFunction · 0.85
ingestElementFunction · 0.85
ingestForeignComponentFunction · 0.85
ingestTemplateFunction · 0.85
ingestContentFunction · 0.85
ingestIfBlockFunction · 0.85
ingestSwitchBlockFunction · 0.85
ingestDeferViewFunction · 0.85
ingestForBlockFunction · 0.85

Calls 11

ingestElementFunction · 0.85
ingestTemplateFunction · 0.85
ingestContentFunction · 0.85
ingestTextFunction · 0.85
ingestBoundTextFunction · 0.85
ingestIfBlockFunction · 0.85
ingestSwitchBlockFunction · 0.85
ingestDeferBlockFunction · 0.85
ingestIcuFunction · 0.85
ingestForBlockFunction · 0.85
ingestLetDeclarationFunction · 0.85

Tested by

no test coverage detected