| 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 — |