Function
findNode
(ast: AstNode[], fn: (node: AstNode) => boolean)
Source from the content-addressed store, hash-verified
| 890 | } |
| 891 | |
| 892 | function findNode(ast: AstNode[], fn: (node: AstNode) => boolean): AstNode[] | null { |
| 893 | let foundPath: AstNode[] = [] |
| 894 | walk(ast, (node, ctx) => { |
| 895 | if (fn(node)) { |
| 896 | foundPath = ctx.path() |
| 897 | foundPath.push(node) |
| 898 | return WalkAction.Stop |
| 899 | } |
| 900 | }) |
| 901 | return foundPath |
| 902 | } |
| 903 | |
| 904 | // Find out if a variable is either used directly or if any of the variables that depend on it are |
| 905 | // used |
Tested by
no test coverage detected