MCPcopy Index your code
hub / github.com/angular/angular / findExpressionInNode

Function findExpressionInNode

packages/compiler/test/render3/view/util.ts:106–119  ·  view source on GitHub ↗
(node: a.Node, expr: string)

Source from the content-addressed store, hash-verified

104}
105
106function findExpressionInNode(node: a.Node, expr: string): e.AST | null {
107 if (node instanceof a.Element || node instanceof a.Template || node instanceof a.Component) {
108 return findExpression([...node.inputs, ...node.outputs, ...node.children], expr);
109 } else if (node instanceof a.Directive) {
110 return findExpression([...node.inputs, ...node.outputs], expr);
111 } else if (node instanceof a.BoundAttribute || node instanceof a.BoundText) {
112 const ts = toStringExpression(node.value);
113 return ts === expr ? node.value : null;
114 } else if (node instanceof a.BoundEvent) {
115 return toStringExpression(node.handler) === expr ? node.handler : null;
116 } else {
117 return null;
118 }
119}
120
121export function toStringExpression(expr: e.AST): string {
122 while (expr instanceof e.ASTWithSource) {

Callers 1

findExpressionFunction · 0.85

Calls 2

findExpressionFunction · 0.85
toStringExpressionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…