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

Function callable

__tests__/cpp-test-fixture-call.test.ts:40–46  ·  view source on GitHub ↗

The function or method `qualifiedName`, the one in `file` when given.

(cg: CodeGraph, qualifiedName: string, file?: string)

Source from the content-addressed store, hash-verified

38
39/** The function or method `qualifiedName`, the one in `file` when given. */
40function callable(cg: CodeGraph, qualifiedName: string, file?: string): Node {
41 const node = [...cg.getNodesByKind('method'), ...cg.getNodesByKind('function')].find(
42 (n) => n.qualifiedName === qualifiedName && (file === undefined || n.filePath === file),
43 );
44 if (!node) throw new Error(`no function or method ${qualifiedName}`);
45 return node;
46}
47
48/** `calls` callees of a function or method, as `qualifiedName @confidence`, one per call site. */
49function calls(cg: CodeGraph, caller: string, file?: string): string[] {

Callers 2

callsFunction · 0.70
resolversFunction · 0.70

Calls 1

getNodesByKindMethod · 0.65

Tested by

no test coverage detected