(nodes: Node[], callSiteFile: string)
| 521 | * No-op when there are <2 candidates or none share the call site's file. |
| 522 | */ |
| 523 | export function preferCallSiteFile(nodes: Node[], callSiteFile: string): Node[] { |
| 524 | if (nodes.length < 2) return nodes; |
| 525 | const same: Node[] = []; |
| 526 | const other: Node[] = []; |
| 527 | for (const n of nodes) { |
| 528 | if (n.filePath === callSiteFile) same.push(n); |
| 529 | else other.push(n); |
| 530 | } |
| 531 | return same.length ? [...same, ...other] : nodes; |
| 532 | } |
| 533 | |
| 534 | // Exported for the precedence unit tests (#1079): they assert the |
| 535 | // preferredFqn → same-file → matches[0] ordering directly. |
no outgoing calls
no test coverage detected