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

Function callsOf

__tests__/rust-glob-module-paths.test.ts:42–52  ·  view source on GitHub ↗

The `calls` targets of function `fn` in `file`, as ` : `, sorted.

(graph: CodeGraph, file: string, fn: string)

Source from the content-addressed store, hash-verified

40
41/** The `calls` targets of function `fn` in `file`, as `<file>:<qualified name>`, sorted. */
42function callsOf(graph: CodeGraph, file: string, fn: string): string[] {
43 const node = graph.getNodesInFile(file).find((n) => n.name === fn && (n.kind === 'function' || n.kind === 'method'));
44 expect(node, `${file}:${fn}`).toBeDefined();
45 return graph.getOutgoingEdges(node!.id)
46 .filter((e) => e.kind === 'calls')
47 .map((e) => {
48 const t = graph.getNode(e.target)!;
49 return `${t.filePath}:${t.qualifiedName}`;
50 })
51 .sort();
52}
53
54const GZIP = 'pub fn read() -> u8 {\n 1\n}\n\npub fn write() {}\n';
55

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected