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

Function callable

__tests__/cpp-translation-unit-visibility.test.ts:39–45  ·  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

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

Callers 2

callsFunction · 0.70

Calls 1

getNodesByKindMethod · 0.65

Tested by

no test coverage detected