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

Function callEdgesFrom

__tests__/cpp-implicit-this-calls.test.ts:33–40  ·  view source on GitHub ↗

The edges carrying a call's name out of the function or method `qualifiedName` in `file`.

(cg: CodeGraph, file: string, qualifiedName: string)

Source from the content-addressed store, hash-verified

31
32/** The edges carrying a call's name out of the function or method `qualifiedName` in `file`. */
33function callEdgesFrom(cg: CodeGraph, file: string, qualifiedName: string) {
34 const from = cg.getNodesInFile(file).filter((n) => n.qualifiedName === qualifiedName && (n.kind === 'function' || n.kind === 'method'));
35 expect(from.length).toBeGreaterThan(0);
36 return cg.getOutgoingEdgesFrom(from.map((n) => n.id)).flatMap((e) => {
37 const metadata = e.metadata as { refName?: string; resolvedBy?: string } | undefined;
38 return metadata?.refName ? [{ refName: metadata.refName, resolvedBy: metadata.resolvedBy, target: cg.getNode(e.target)!.qualifiedName }] : [];
39 });
40}
41
42/** `name -> target qualified name` for each call (or construction) the named function or method in `file` makes. */
43function callsFrom(cg: CodeGraph, file: string, qualifiedName: string): string[] {

Callers 2

callsFromFunction · 0.85
placedByLookupFunction · 0.85

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected