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

Class CombinedRecursiveAstVisitor

packages/compiler/src/combined_visitor.ts:16–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 * Useful for cases where every single node needs to be visited.
15 */
16export class CombinedRecursiveAstVisitor extends RecursiveAstVisitor implements t.RecursiveVisitor {
17 override visit(node: AST | t.Node): void {
18 if (node instanceof ASTWithSource) {
19 this.visit(node.ast);
20 } else {
21 node.visit(this);
22 }
23 }
24
25 visitElement(element: t.Element): void {
26 this.visitAllTemplateNodes(element.attributes);
27 this.visitAllTemplateNodes(element.inputs);
28 this.visitAllTemplateNodes(element.outputs);
29 this.visitAllTemplateNodes(element.references);
30 this.visitAllTemplateNodes(element.children);
31 }
32
33 visitTemplate(template: t.Template): void {
34 this.visitAllTemplateNodes(template.attributes);
35 this.visitAllTemplateNodes(template.inputs);
36 this.visitAllTemplateNodes(template.outputs);
37 this.visitAllTemplateNodes(template.templateAttrs);
38 this.visitAllTemplateNodes(template.variables);
39 this.visitAllTemplateNodes(template.references);
40 this.visitAllTemplateNodes(template.children);
41 }
42
43 visitContent(content: t.Content): void {
44 this.visitAllTemplateNodes(content.children);
45 }
46
47 visitContentBlock(block: t.ContentBlock): void {
48 this.visitAllTemplateNodes(block.children);
49 }
50
51 visitBoundAttribute(attribute: t.BoundAttribute): void {
52 this.visit(attribute.value);
53 }
54
55 visitBoundEvent(attribute: t.BoundEvent): void {
56 this.visit(attribute.handler);
57 }
58
59 visitBoundText(text: t.BoundText): void {
60 this.visit(text.value);
61 }
62
63 visitIcu(icu: t.Icu): void {
64 Object.keys(icu.vars).forEach((key) => this.visit(icu.vars[key]));
65 Object.keys(icu.placeholders).forEach((key) => this.visit(icu.placeholders[key]));
66 }
67
68 visitDeferredBlock(deferred: t.DeferredBlock): void {
69 deferred.visitAll(this);
70 }
71
72 visitDeferredTrigger(trigger: t.DeferredTrigger): void {
73 if (trigger instanceof t.BoundDeferredTrigger) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected