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

Function callsFrom

__tests__/cpp-global-scope-names.test.ts:32–42  ·  view source on GitHub ↗

* `name -> target qualified name` for every reference the named function or * method in `file` resolves — a call to a struct is an `instantiates` edge.

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

Source from the content-addressed store, hash-verified

30 * method in `file` resolves — a call to a struct is an `instantiates` edge.
31 */
32function callsFrom(cg: CodeGraph, file: string, name: string): string[] {
33 const from = cg.getNodesInFile(file).filter((n) => n.name === name && (n.kind === 'function' || n.kind === 'method'));
34 expect(from.length).toBeGreaterThan(0);
35 return cg
36 .getOutgoingEdgesFrom(from.map((n) => n.id))
37 .flatMap((e) => {
38 const refName = (e.metadata as { refName?: string } | undefined)?.refName;
39 return refName ? [`${refName} -> ${cg.getNode(e.target)!.qualifiedName}`] : [];
40 })
41 .sort();
42}
43
44const PB_INTERNAL = `#pragma once
45namespace pb {

Callers 1

Calls 4

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

Tested by

no test coverage detected