(tmpl: a.Node[], expr: string)
| 87 | } |
| 88 | |
| 89 | export function findExpression(tmpl: a.Node[], expr: string): e.AST | null { |
| 90 | const res = tmpl.reduce( |
| 91 | (found, node) => { |
| 92 | if (found !== null) { |
| 93 | return found; |
| 94 | } else { |
| 95 | return findExpressionInNode(node, expr); |
| 96 | } |
| 97 | }, |
| 98 | null as e.AST | null, |
| 99 | ); |
| 100 | if (res instanceof e.ASTWithSource) { |
| 101 | return res.ast; |
| 102 | } |
| 103 | return res; |
| 104 | } |
| 105 | |
| 106 | function findExpressionInNode(node: a.Node, expr: string): e.AST | null { |
| 107 | if (node instanceof a.Element || node instanceof a.Template || node instanceof a.Component) { |
no test coverage detected
searching dependent graphs…