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

Function ingestNodes

packages/compiler/src/template/pipeline/src/ingest.ts:241–271  ·  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

239 * Ingest the nodes of a template AST into the given `ViewCompilation`.
240 */
241function 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`.

Callers 8

ingestComponentFunction · 0.85
ingestElementFunction · 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