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