Resolve a registered handler name to its callable entry: a function value, or a class's * `execute`-like method (preferring the method chained at the dispatch site), else the class.
(ctx: ResolutionContext, name: string, chained: string | null)
| 2204 | /** Resolve a registered handler name to its callable entry: a function value, or a class's |
| 2205 | * `execute`-like method (preferring the method chained at the dispatch site), else the class. */ |
| 2206 | function resolveRegistryHandler(ctx: ResolutionContext, name: string, chained: string | null): Node | null { |
| 2207 | const cands = ctx.getNodesByName(name); |
| 2208 | const fn = cands.find((n) => n.kind === 'function'); |
| 2209 | if (fn) return fn; |
| 2210 | const cls = cands.find((n) => n.kind === 'class' || n.kind === 'struct'); |
| 2211 | if (cls) { |
| 2212 | const methods = ctx |
| 2213 | .getNodesInFile(cls.filePath) |
| 2214 | .filter((n) => n.kind === 'method' && n.startLine >= cls.startLine && n.startLine <= (cls.endLine ?? cls.startLine)); |
| 2215 | const want = chained && REGISTRY_CLASS_ENTRY.has(chained) ? chained : null; |
| 2216 | const entry = |
| 2217 | (want && methods.find((m) => m.name === want)) || |
| 2218 | methods.find((m) => REGISTRY_CLASS_ENTRY.has(m.name)) || |
| 2219 | methods.find((m) => m.name === 'constructor'); |
| 2220 | return entry ?? cls; |
| 2221 | } |
| 2222 | // Require a CALLABLE target — a registry dispatched as `reg[k](…)` invokes a function/ |
| 2223 | // method, never a data `constant` (dropping it removes false positives like a `{ x: URL }` |
| 2224 | // entry resolving to the global URL constant). |
| 2225 | return cands.find((n) => n.kind === 'method') ?? null; |
| 2226 | } |
| 2227 | |
| 2228 | async function objectRegistryEdges(ctx: ResolutionContext, onYield: MaybeYield): Promise<Edge[]> { |
| 2229 | let scannedFiles = 0; |
no test coverage detected