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

Function callsAt

__tests__/cpp-nullptr-deleted-overloads.test.ts:35–44  ·  view source on GitHub ↗

What the calls at `line` of the function or method `qualifiedName` reach, as `target:its first line @confidence`.

(cg: CodeGraph, qualifiedName: string, line: number)

Source from the content-addressed store, hash-verified

33
34/** What the calls at `line` of the function or method `qualifiedName` reach, as `target:its first line @confidence`. */
35function callsAt(cg: CodeGraph, qualifiedName: string, line: number): string[] {
36 const from = [...cg.getNodesByKind('method'), ...cg.getNodesByKind('function')].find((n) => n.qualifiedName === qualifiedName)!;
37 return cg.getOutgoingEdgesFrom([from.id], ['calls'])
38 .filter((e) => e.line === line)
39 .map((e) => {
40 const t = cg.getNode(e.target)!;
41 return `${t.qualifiedName}:${t.startLine} @${(e.metadata as { confidence?: number } | undefined)?.confidence}`;
42 })
43 .sort();
44}
45
46describe('C++ overloads for nullptr, and deleted ones', () => {
47 it("takes protobuf's reset(std::nullptr_t) for reset(nullptr), not the deleted reset(T*)", async () => {

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected