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

Function methodCalls

__tests__/js-receiver-binding-scope.test.ts:45–55  ·  view source on GitHub ↗

`caller -> Owner::method` for every `calls` edge out of `file` that lands on a method.

(graph: CodeGraph, file: string)

Source from the content-addressed store, hash-verified

43
44/** `caller -> Owner::method` for every `calls` edge out of `file` that lands on a method. */
45function methodCalls(graph: CodeGraph, file: string): string[] {
46 const out: string[] = [];
47 for (const node of graph.getNodesInFile(file)) {
48 for (const e of graph.getOutgoingEdges(node.id)) {
49 if (e.kind !== 'calls') continue;
50 const target = graph.getNode(e.target)!;
51 if (target.kind === 'method') out.push(`${node.name} -> ${target.qualifiedName}`);
52 }
53 }
54 return out.sort();
55}
56
57const BOUNDARY = 'import { Component } from "react";\nexport class Boundary extends Component<{ children?: React.ReactNode }> {\n render() { return this.props.children; }\n}\n';
58

Calls 4

getNodeMethod · 0.80
pushMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected