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

Method ingest

packages/compiler/src/render3/view/t2_binder.ts:334–365  ·  view source on GitHub ↗

* Internal method to process the scoped node and populate the `Scope`.

(nodeOrNodes: ScopedNode | Node[])

Source from the content-addressed store, hash-verified

332 * Internal method to process the scoped node and populate the `Scope`.
333 */
334 private ingest(nodeOrNodes: ScopedNode | Node[]): void {
335 if (nodeOrNodes instanceof Template) {
336 // Variables on an <ng-template> are defined in the inner scope.
337 nodeOrNodes.variables.forEach((node) => this.visitVariable(node));
338
339 // Process the nodes of the template.
340 nodeOrNodes.children.forEach((node) => node.visit(this));
341 } else if (nodeOrNodes instanceof IfBlockBranch) {
342 if (nodeOrNodes.expressionAlias !== null) {
343 this.visitVariable(nodeOrNodes.expressionAlias);
344 }
345 nodeOrNodes.children.forEach((node) => node.visit(this));
346 } else if (nodeOrNodes instanceof ForLoopBlock) {
347 this.visitVariable(nodeOrNodes.item);
348 nodeOrNodes.contextVariables.forEach((v) => this.visitVariable(v));
349 nodeOrNodes.children.forEach((node) => node.visit(this));
350 } else if (
351 nodeOrNodes instanceof SwitchBlockCaseGroup ||
352 nodeOrNodes instanceof ForLoopBlockEmpty ||
353 nodeOrNodes instanceof DeferredBlock ||
354 nodeOrNodes instanceof DeferredBlockError ||
355 nodeOrNodes instanceof DeferredBlockPlaceholder ||
356 nodeOrNodes instanceof DeferredBlockLoading ||
357 nodeOrNodes instanceof ContentBlock ||
358 nodeOrNodes instanceof Content
359 ) {
360 nodeOrNodes.children.forEach((node) => node.visit(this));
361 } else if (!(nodeOrNodes instanceof HostElement)) {
362 // No overarching `Template` instance, so process the nodes directly.
363 nodeOrNodes.forEach((node) => node.visit(this));
364 }
365 }
366
367 visitElement(element: Element) {
368 this.visitElementLike(element);

Callers 2

ingestScopedNodeMethod · 0.95
applyMethod · 0.45

Calls 3

visitVariableMethod · 0.95
visitMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected