MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / fileScopeEdgesWithin

Function fileScopeEdgesWithin

src/ui-server/api/steps.ts:1670–1682  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

1668 * constant spans them).
1669 */
1670function 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. */
1685function fileScopeRefsWithin(cg: CodeGraph, node: Node, memo: Map<string, UnresolvedReference[]>): UnresolvedReference[] {

Callers 1

buildStepsFunction · 0.85

Calls 4

getMethod · 0.65
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected