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

Function callers

__tests__/pascal-delphi-syntax.test.ts:508–511  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

506 const cg = await CodeGraph.init(dir, { index: true });
507 try {
508 const callers = (name: string) => {
509 const target = cg.getNodesByKind('function').find((n) => n.qualifiedName === name && n.filePath === 'Lib.pas');
510 return target ? cg.getIncomingEdges(target.id).filter((e) => e.kind === 'calls').map((e) => cg.getNode(e.source)?.name) : [];
511 };
512 expect(callers('Translate')).toEqual(['KeyUp']);
513 expect(callers('Emit')).toEqual(['Generate']);
514 } finally {

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getIncomingEdgesMethod · 0.65

Tested by

no test coverage detected