(files: Record<string, string>, manifest = '')
| 24 | }); |
| 25 | |
| 26 | async function index(files: Record<string, string>, manifest = ''): Promise<CodeGraph> { |
| 27 | root = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-rust-glob-mod-')); |
| 28 | const all: Record<string, string> = { |
| 29 | 'Cargo.toml': `[package]\nname = "repro"\nversion = "0.1.0"\nedition = "2021"\n${manifest}`, |
| 30 | ...files, |
| 31 | }; |
| 32 | for (const [rel, text] of Object.entries(all)) { |
| 33 | const dest = path.join(root, rel); |
| 34 | fs.mkdirSync(path.dirname(dest), { recursive: true }); |
| 35 | fs.writeFileSync(dest, text); |
| 36 | } |
| 37 | cg = await CodeGraph.init(root, { index: true }); |
| 38 | return cg; |
| 39 | } |
| 40 | |
| 41 | /** The `calls` targets of function `fn` in `file`, as `<file>:<qualified name>`, sorted. */ |
| 42 | function callsOf(graph: CodeGraph, file: string, fn: string): string[] { |
no test coverage detected