MCPcopy
hub / github.com/angular/angular / ExpressionSourceHumanizer

Class ExpressionSourceHumanizer

packages/compiler/test/render3/util/expression.ts:16–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15type HumanizedExpressionSource = [string, AbsoluteSourceSpan];
16class ExpressionSourceHumanizer extends e.RecursiveAstVisitor implements t.Visitor {
17 result: HumanizedExpressionSource[] = [];
18
19 private recordAst(ast: e.AST) {
20 this.result.push([unparse(ast), ast.sourceSpan]);
21 }
22
23 // This method is defined to reconcile the type of ExpressionSourceHumanizer
24 // since both RecursiveAstVisitor and Visitor define the visit() method in
25 // their interfaces.
26 override visit(node: e.AST | t.Node, context?: any) {
27 if (node instanceof e.AST) {
28 node.visit(this, context);
29 } else {
30 node.visit(this);
31 }
32 }
33
34 visitASTWithSource(ast: e.ASTWithSource) {
35 this.recordAst(ast);
36 this.visitAll([ast.ast], null);
37 }
38 override visitBinary(ast: e.Binary) {
39 this.recordAst(ast);
40 super.visitBinary(ast, null);
41 }
42 override visitChain(ast: e.Chain) {
43 this.recordAst(ast);
44 super.visitChain(ast, null);
45 }
46 override visitConditional(ast: e.Conditional) {
47 this.recordAst(ast);
48 super.visitConditional(ast, null);
49 }
50 override visitImplicitReceiver(ast: e.ImplicitReceiver) {
51 this.recordAst(ast);
52 super.visitImplicitReceiver(ast, null);
53 }
54 override visitInterpolation(ast: e.Interpolation) {
55 this.recordAst(ast);
56 super.visitInterpolation(ast, null);
57 }
58 override visitKeyedRead(ast: e.KeyedRead) {
59 this.recordAst(ast);
60 super.visitKeyedRead(ast, null);
61 }
62 override visitLiteralPrimitive(ast: e.LiteralPrimitive) {
63 this.recordAst(ast);
64 super.visitLiteralPrimitive(ast, null);
65 }
66 override visitLiteralArray(ast: e.LiteralArray) {
67 this.recordAst(ast);
68 super.visitLiteralArray(ast, null);
69 }
70 override visitLiteralMap(ast: e.LiteralMap) {
71 this.recordAst(ast);
72 super.visitLiteralMap(ast, null);
73 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…