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

Function callsFrom

__tests__/operator-method-names.test.ts:155–161  ·  view source on GitHub ↗
(cg: CodeGraph, file: string, line: number)

Source from the content-addressed store, hash-verified

153
154 /** `<qualified name>@<file>:<line>` of each call from the node at `file`:`line`. */
155 const callsFrom = (cg: CodeGraph, file: string, line: number): string[] => {
156 const from = cg.getNodesInFile(file).find((n: Node) => n.startLine === line && (n.kind === 'method' || n.kind === 'function'));
157 expect(from, `${file}:${line}`).toBeDefined();
158 return cg.getCallees(from!.id).filter((r) => r.edge.kind === 'calls')
159 .map((r) => `${r.node.qualifiedName}@${path.basename(r.node.filePath)}:${r.node.startLine}`)
160 .sort();
161 };
162
163 const hpp = (needle: string): string => `counter.hpp:${lineOf(COUNTER_HPP, needle)}`;
164 const cpp = (needle: string): string => `counter.cpp:${lineOf(COUNTER_CPP, needle)}`;

Callers 1

Calls 3

mapMethod · 0.80
getNodesInFileMethod · 0.65
getCalleesMethod · 0.45

Tested by

no test coverage detected