* Function-as-value references — and, for a value, calls — made at a file's * top level within a node's lines: what `const Memoized = memo(CaptureComponent)` * leaves behind (the reference belongs to the file scope, the wrapper node * spans the line), and what `const worker = new Worker('q', asyn
(cg: CodeGraph, node: Node, memo: Map<string, Edge[]>, calls: boolean)
| 1668 | * constant spans them). |
| 1669 | */ |
| 1670 | function fileScopeEdgesWithin(cg: CodeGraph, node: Node, memo: Map<string, Edge[]>, calls: boolean): Edge[] { |
| 1671 | let refs = memo.get(node.filePath); |
| 1672 | if (refs === undefined) { |
| 1673 | const file = cg.getNodesInFile(node.filePath).find((n) => n.kind === 'file'); |
| 1674 | refs = file |
| 1675 | ? cg |
| 1676 | .getOutgoingEdgesFrom([file.id], ['references', 'calls', 'navigates']) |
| 1677 | .filter((e) => e.kind !== 'references' || (e.metadata as Record<string, unknown> | undefined)?.fnRef === true) |
| 1678 | : []; |
| 1679 | memo.set(node.filePath, refs); |
| 1680 | } |
| 1681 | return refs.filter((e) => (calls || e.kind === 'references') && typeof e.line === 'number' && e.line >= node.startLine && e.line <= node.endLine); |
| 1682 | } |
| 1683 | |
| 1684 | /** The file scope's unresolved calls within a value's lines — what a wrapped handler's arrow body leaves on the file node. */ |
| 1685 | function fileScopeRefsWithin(cg: CodeGraph, node: Node, memo: Map<string, UnresolvedReference[]>): UnresolvedReference[] { |
no test coverage detected