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

Function targets

__tests__/rust-prelude-scope.test.ts:60–66  ·  view source on GitHub ↗
(fn: string)

Source from the content-addressed store, hash-verified

58 const cg = await CodeGraph.init(root, { index: true });
59 try {
60 const targets = (fn: string): string[] => {
61 const from = cg.getNodesByName(fn).filter((n) => n.kind === 'function');
62 return cg
63 .getOutgoingEdgesFrom(from.map((n) => n.id), ['calls', 'references', 'instantiates'])
64 .map((e) => cg.getNode(e.target)!)
65 .map((n) => `${n.kind}:${n.qualifiedName}`);
66 };
67 // Prelude `Some` / `Ok`, not the project's variants or structs.
68 expect(targets('find').filter((t) => /Some|Ok|Result/.test(t))).toEqual([]);
69 // `use EncodingMode::*` brings the variant in.

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByNameMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected