(backend: string)
| 135 | }); |
| 136 | |
| 137 | async function index(backend: string): Promise<CodeGraph> { |
| 138 | savedKernel = process.env.CODEGRAPH_KERNEL; |
| 139 | if (backend === 'wasm') process.env.CODEGRAPH_KERNEL = '0'; |
| 140 | else delete process.env.CODEGRAPH_KERNEL; |
| 141 | root = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-ruby-singleton-')); |
| 142 | for (const [rel, content] of Object.entries(FILES)) { |
| 143 | fs.mkdirSync(path.dirname(path.join(root, rel)), { recursive: true }); |
| 144 | fs.writeFileSync(path.join(root, rel), content); |
| 145 | } |
| 146 | cg = await CodeGraph.init(root, { index: true }); |
| 147 | return cg; |
| 148 | } |
| 149 | |
| 150 | /** `<qualified name>:<line>` of the method each `calls` edge written on `line` of `file` reaches. */ |
| 151 | function callsAt(graph: CodeGraph, file: string, line: number): string[] { |
no test coverage detected