* Candidates-only scan of a subtree the main walkers won't traverse * (top-level variable initializers). No extraction side effects. Halts at * nested function definitions: their bodies are walked — and their * candidates attributed — by extractFunction's own body walk.
(node: SyntaxNode, depth: number, walked?: ReadonlySet<number>)
| 1196 | * candidates attributed — by extractFunction's own body walk. |
| 1197 | */ |
| 1198 | private scanFnRefSubtree(node: SyntaxNode, depth: number, walked?: ReadonlySet<number>): void { |
| 1199 | if (!this.fnRefSpec || depth > 12) return; |
| 1200 | // Subtrees the body walker has already been through. |
| 1201 | if (walked?.has(node.id)) return; |
| 1202 | const nodeType = node.type; |
| 1203 | if (depth > 0 && ( |
| 1204 | this.extractor?.functionTypes.includes(nodeType) || |
| 1205 | ((this.language === 'lua' || this.language === 'luau') && nodeType === 'function_definition') || |
| 1206 | nodeType === 'arrow_function' || |
| 1207 | nodeType === 'function_expression' || |
| 1208 | nodeType === 'lambda_literal' || |
| 1209 | nodeType === 'lambda_expression' |
| 1210 | )) { |
| 1211 | return; |
| 1212 | } |
| 1213 | this.maybeCaptureFnRefs(node, nodeType); |
| 1214 | for (let i = 0; i < node.namedChildCount; i++) { |
| 1215 | const child = node.namedChild(i); |
| 1216 | if (child) this.scanFnRefSubtree(child, depth + 1, walked); |
| 1217 | } |
| 1218 | } |
| 1219 | |
| 1220 | /** |
| 1221 | * Gate captured function-as-value candidates and push survivors as |
no test coverage detected