(method: string, callText: string, only?: string)
| 443 | |
| 444 | /** The parameter lists a method's call on the given line text reaches (of `only`, when there are two on the line). */ |
| 445 | const calledFrom = (method: string, callText: string, only?: string): string[] => { |
| 446 | const from = cg.getNodesByKind('method').find((n: Node) => n.name === method); |
| 447 | expect(from, method).toBeDefined(); |
| 448 | const file = from!.filePath; |
| 449 | const line = lines[file]!.findIndex((text, i) => i >= from!.startLine - 1 && text.includes(callText)) + 1; |
| 450 | expect(line, callText).toBeGreaterThan(0); |
| 451 | return cg.getOutgoingEdges(from!.id).filter((e) => e.kind === 'calls' && e.line === line) |
| 452 | .map((e) => cg.getNode(e.target)!).filter((n) => !only || n.name === only) |
| 453 | .map((n) => n.signature ?? '').map((s) => s.slice(s.indexOf('('))).sort(); |
| 454 | }; |
| 455 | |
| 456 | beforeAll(async () => { |
| 457 | dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-java-overloads-')); |
no test coverage detected