* Resolve a symbol name to a single node ID, preferring candidates * from the same file as the caller to avoid cross-file collisions.
(key: string, callerFile?: string)
| 737 | * from the same file as the caller to avoid cross-file collisions. |
| 738 | */ |
| 739 | function resolveSymbol(key: string, callerFile?: string): number | undefined { |
| 740 | const candidates = nodeSymbolIndex.get(key); |
| 741 | if (!candidates?.length) return undefined; |
| 742 | if (candidates.length === 1) return candidates[0]; |
| 743 | if (callerFile) { |
| 744 | const sameFile = candidates.find(id => nodes[id - 1]?.file === callerFile); |
| 745 | if (sameFile !== undefined) return sameFile; |
| 746 | } |
| 747 | return candidates[0]; |
| 748 | } |
| 749 | |
| 750 | async function processNextBatch() { |
| 751 | if (pendingFileQueue.length === 0) { |