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

Class RecursiveVisitor

packages/compiler/src/ml_parser/ast.ts:216–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216export class RecursiveVisitor implements Visitor {
217 constructor() {}
218
219 visitElement(ast: Element, context: any): any {
220 this.visitChildren(context, (visit) => {
221 visit(ast.attrs);
222 visit(ast.comments);
223 visit(ast.children);
224 });
225 }
226
227 visitAttribute(ast: Attribute, context: any): any {}
228 visitStartTagComment(ast: StartTagComment, context: any): any {}
229 visitText(ast: Text, context: any): any {}
230 visitComment(ast: Comment, context: any): any {}
231
232 visitExpansion(ast: Expansion, context: any): any {
233 return this.visitChildren(context, (visit) => {
234 visit(ast.cases);
235 });
236 }
237
238 visitExpansionCase(ast: ExpansionCase, context: any): any {}
239
240 visitBlock(block: Block, context: any): any {
241 this.visitChildren(context, (visit) => {
242 visit(block.parameters);
243 visit(block.children);
244 });
245 }
246
247 visitBlockParameter(ast: BlockParameter, context: any): any {}
248
249 visitLetDeclaration(decl: LetDeclaration, context: any) {}
250
251 private visitChildren(
252 context: any,
253 cb: (visit: <V extends Node>(children: V[] | undefined) => void) => void,
254 ) {
255 let results: any[][] = [];
256 let t = this;
257 function visit<T extends Node>(children: T[] | undefined) {
258 if (children) results.push(visitAll(t, children, context));
259 }
260 cb(visit);
261 return Array.prototype.concat.apply([], results);
262 }
263}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected