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

Function callsFrom

__tests__/cpp-undeclared-qualifier.test.ts:63–72  ·  view source on GitHub ↗

Where the `calls` edges written in `file` lead, as `name @ file:line` of each target.

(cg: CodeGraph, file: string)

Source from the content-addressed store, hash-verified

61
62/** Where the `calls` edges written in `file` lead, as `name @ file:line` of each target. */
63function callsFrom(cg: CodeGraph, file: string): string[] {
64 const out: string[] = [];
65 for (const caller of [...cg.getNodesByKind('method'), ...cg.getNodesByKind('function')]) {
66 if (caller.filePath !== file) continue;
67 for (const r of cg.getCallees(caller.id)) {
68 if (r.edge.kind === 'calls') out.push(`${r.node.name} @ ${r.node.filePath}:${r.node.startLine}`);
69 }
70 }
71 return out.sort();
72}
73
74const lines = (...l: string[]): string => [...l, ''].join('\n');
75

Calls 3

pushMethod · 0.80
getNodesByKindMethod · 0.65
getCalleesMethod · 0.45

Tested by

no test coverage detected