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

Function load

__tests__/php-property-receiver-resolution.test.ts:48–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 };
47
48 const load = async () => {
49 const cg = await CodeGraph.init(dir, { silent: true });
50 await cg.indexAll();
51 const db = (cg as any).db.db;
52 const calls: { src: string; tgt: string; tgtQn: string }[] = db
53 .prepare(
54 `SELECT s.name src, t.name tgt, t.qualified_name tgtQn
55 FROM edges e JOIN nodes s ON s.id = e.source JOIN nodes t ON t.id = e.target
56 WHERE e.kind = 'calls' AND t.kind = 'method'`,
57 )
58 .all();
59 cg.close?.();
60 return calls;
61 };
62 const hasCall = (calls: any[], src: string, tgtQn: string) =>
63 calls.some((e) => e.src === src && e.tgtQn === tgtQn);
64 // Any resolved method call `src` makes to a method of the given bare name —

Calls 5

allMethod · 0.65
prepareMethod · 0.65
closeMethod · 0.65
initMethod · 0.45
indexAllMethod · 0.45

Tested by

no test coverage detected