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

Function targetOf

__tests__/frameworks-integration.test.ts:1454–1463  ·  view source on GitHub ↗
(cg: CodeGraph, fromName: string, calleeName: string)

Source from the content-addressed store, hash-verified

1452 });
1453
1454 const targetOf = (cg: CodeGraph, fromName: string, calleeName: string): string | undefined => {
1455 const from = cg.getNodesByKind('method').find((n) => n.name === fromName);
1456 expect(from).toBeDefined();
1457 const edge = cg
1458 .getOutgoingEdges(from!.id)
1459 .filter((e) => e.kind === 'calls' || e.kind === 'references')
1460 .map((e) => cg.getNode(e.target))
1461 .find((t) => t?.name === calleeName);
1462 return edge?.qualifiedName;
1463 };
1464
1465 it('picks the named nested class member, not the first same-named method in its file', async () => {
1466 tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-play-member-'));

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected