Collect identifier strings declared as parameters within `node`.
(node: any, source: string, into: Set<string>)
| 64 | |
| 65 | /** Collect identifier strings declared as parameters within `node`. */ |
| 66 | function collectParams(node: any, source: string, into: Set<string>): void { |
| 67 | const params = node.childForFieldName?.('parameters'); |
| 68 | if (!params) return; |
| 69 | const walk = (n: any) => { |
| 70 | if (!n) return; |
| 71 | if (n.type === 'identifier' || n.type === 'shorthand_property_identifier_pattern') { |
| 72 | into.add(source.slice(n.startIndex, n.endIndex)); |
| 73 | } |
| 74 | for (let i = 0; i < (n.childCount ?? 0); i++) walk(n.child(i)); |
| 75 | }; |
| 76 | walk(params); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Analyze every top-level-ish function in a file and return its free variables. |
no test coverage detected