Every routine's calls as `Caller->Callee`, sorted, and each routine's lines as `Name:start-end`.
(code: string, file: string)
| 37 | |
| 38 | /** Every routine's calls as `Caller->Callee`, sorted, and each routine's lines as `Name:start-end`. */ |
| 39 | function extract(code: string, file: string): { calls: string[]; routines: string[] } { |
| 40 | const result = extractFromSource(file, code); |
| 41 | const byId = new Map(result.nodes.map((n) => [n.id, n])); |
| 42 | return { |
| 43 | calls: result.unresolvedReferences |
| 44 | .filter((r) => r.referenceKind === 'calls') |
| 45 | .map((r) => `${byId.get(r.fromNodeId)?.name}->${r.referenceName}`) |
| 46 | .sort(), |
| 47 | routines: result.nodes |
| 48 | .filter((n) => (n.kind === 'method' || n.kind === 'function') && n.startLine !== n.endLine) |
| 49 | .sort((a, b) => a.startLine - b.startLine) |
| 50 | .map((n) => `${n.name}:${n.startLine}-${n.endLine}`), |
| 51 | }; |
| 52 | } |
| 53 | |
| 54 | // mORMot2's shape: on x86 a `case` whose `else` the shared code ends, elsewhere a `begin` that it ends, with |
| 55 | // conditionals of its own in that branch. |
no test coverage detected