For each call the method `from` makes to `name`, by line: the signature of the overload it reaches.
(name: string, from = 'Paint')
| 90 | |
| 91 | /** For each call the method `from` makes to `name`, by line: the signature of the overload it reaches. */ |
| 92 | function reached(name: string, from = 'Paint'): string[] { |
| 93 | const caller = cg!.getNodesInFile('Win.pas').find((n) => n.name === from && n.kind === 'method'); |
| 94 | expect(caller).toBeDefined(); |
| 95 | return cg! |
| 96 | .getOutgoingEdges(caller!.id) |
| 97 | .filter((e) => e.kind === 'calls') |
| 98 | .map((e) => ({ line: e.line ?? 0, target: cg!.getNode(e.target)! })) |
| 99 | .filter((c) => c.target.name === name) |
| 100 | .sort((a, b) => a.line - b.line) |
| 101 | .map((c) => c.target.signature ?? ''); |
| 102 | } |
| 103 | |
| 104 | it('reaches the one-parameter overload for one argument, though the other is implemented nearer', () => { |
| 105 | expect(reached('SetRedraw')).toEqual(['(const Value: Boolean)', '(Handle: Integer; const Value: Boolean)']); |
no test coverage detected