(nodes: Node[], callSiteFile: string)
| 533 | * No-op when there are <2 candidates or none share the call site's file. |
| 534 | */ |
| 535 | export function preferCallSiteFile(nodes: Node[], callSiteFile: string): Node[] { |
| 536 | if (nodes.length < 2) return nodes; |
| 537 | const same: Node[] = []; |
| 538 | const other: Node[] = []; |
| 539 | for (const n of nodes) { |
| 540 | if (n.filePath === callSiteFile) same.push(n); |
| 541 | else other.push(n); |
| 542 | } |
| 543 | return same.length ? [...same, ...other] : nodes; |
| 544 | } |
| 545 | |
| 546 | // Exported for the precedence unit tests (#1079): they assert the |
| 547 | // preferredFqn → same-file → matches[0] ordering directly. |
no outgoing calls
no test coverage detected