(files: Record<string, string>, check: (cg: CodeGraph) => void)
| 22 | }); |
| 23 | |
| 24 | async function withIndex(files: Record<string, string>, check: (cg: CodeGraph) => void): Promise<void> { |
| 25 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-pascal-nested-')); |
| 26 | try { |
| 27 | for (const [name, code] of Object.entries(files)) fs.writeFileSync(path.join(dir, name), code); |
| 28 | const cg = await CodeGraph.init(dir, { index: true }); |
| 29 | try { |
| 30 | check(cg); |
| 31 | } finally { |
| 32 | cg.close(); |
| 33 | } |
| 34 | } finally { |
| 35 | fs.rmSync(dir, { recursive: true, force: true }); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | function routine(cg: CodeGraph, qualifiedName: string) { |
| 40 | const node = cg.getNodesByKind('method').concat(cg.getNodesByKind('function')).find((n) => n.qualifiedName === qualifiedName); |
no test coverage detected