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

Function withIndex

__tests__/pascal-system-calls.test.ts:27–40  ·  view source on GitHub ↗
(files: Record<string, string>, check: (cg: CodeGraph) => void)

Source from the content-addressed store, hash-verified

25});
26
27async function withIndex(files: Record<string, string>, check: (cg: CodeGraph) => void): Promise<void> {
28 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-pascal-system-'));
29 try {
30 for (const [name, code] of Object.entries(files)) fs.writeFileSync(path.join(dir, name), code);
31 const cg = await CodeGraph.init(dir, { index: true });
32 try {
33 check(cg);
34 } finally {
35 cg.close();
36 }
37 } finally {
38 fs.rmSync(dir, { recursive: true, force: true });
39 }
40}
41
42/** The calls a routine makes, as `line: Target::Name`. */
43function callsFrom(cg: CodeGraph, qualifiedName: string): string[] {

Callers 1

Calls 4

checkFunction · 0.70
closeMethod · 0.65
joinMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected