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

Function calls

__tests__/cpp-specialization-names.test.ts:377–382  ·  view source on GitHub ↗
(name: string, line?: number)

Source from the content-addressed store, hash-verified

375
376 /** `<qualified name>@<line>` of what the function or method `name` (at `line`, if given) calls. */
377 const calls = (name: string, line?: number): string[] => {
378 const caller = [...cg.getNodesByKind('function'), ...cg.getNodesByKind('method')]
379 .find((n: Node) => n.qualifiedName === name && (line === undefined || n.startLine === line))!;
380 expect(caller, name).toBeDefined();
381 return cg.getCallees(caller.id).filter((r) => r.edge.kind === 'calls').map((r) => `${r.node.qualifiedName}@${r.node.startLine}`);
382 };
383
384 it('the specialization the call writes the arguments of', () => {
385 expect(calls('pb::Read')).toEqual(['pb::WireFormatLite::ReadPrimitive@12']);

Calls 3

mapMethod · 0.80
getNodesByKindMethod · 0.65
getCalleesMethod · 0.45

Tested by

no test coverage detected