(defNodes: Node[])
| 3444 | // Every site of each caller (#2909): one row per caller, at the lines its |
| 3445 | // calls sit on, and the symbol itself when it calls itself. |
| 3446 | const collect = (defNodes: Node[]) => { |
| 3447 | const callers: Node[] = []; |
| 3448 | const labels = new Map<string, string>(); |
| 3449 | const sites = new Map<string, Edge[]>(); |
| 3450 | const recursive = new Set<string>(); |
| 3451 | for (const node of defNodes) { |
| 3452 | for (const c of cg.getCallSites(node.id, 'callers')) { |
| 3453 | const known = sites.get(c.node.id); |
| 3454 | if (known) { |
| 3455 | known.push(...c.edges); |
| 3456 | continue; |
| 3457 | } |
| 3458 | sites.set(c.node.id, [...c.edges]); |
| 3459 | if (c.recursive) recursive.add(c.node.id); |
| 3460 | callers.push(c.node); |
| 3461 | answerPaths.add(c.node.filePath); |
| 3462 | const label = this.edgeLabel(c.edges[0]!); |
| 3463 | if (label) labels.set(c.node.id, label); |
| 3464 | } |
| 3465 | } |
| 3466 | const locations = new Map(callers.map((n) => [n.id, this.callSiteLocation(n, sites.get(n.id) ?? [])])); |
| 3467 | return { callers, labels, locations, recursive }; |
| 3468 | }; |
| 3469 | |
| 3470 | // Single definition (or same-file overloads): the familiar flat list. |
| 3471 | if (groups.length === 1) { |
nothing calls this directly
no test coverage detected