* What a file holds that a flow reads: see FlowFacts. A call that failed counts * as much as one that resolved, so it reads the same whichever way a sync's * resolution goes. The order is the file's, which an ancestor's depends on.
(filePath: string)
| 158 | * resolution goes. The order is the file's, which an ancestor's depends on. |
| 159 | */ |
| 160 | getFlowFacts(filePath: string): FlowFacts { |
| 161 | type Fact = { kind: string; line: number | null; col: number | null; owner: string | null; ref?: string | null; name?: string }; |
| 162 | const facts = [FACT_NODES, FACT_EDGES, FACT_REFS].flatMap((sql) => this.statement(sql).all(filePath)) as Fact[]; |
| 163 | facts.sort((a, b) => (a.line ?? 0) - (b.line ?? 0) || (a.col ?? 0) - (b.col ?? 0)); |
| 164 | const found: FlowFacts = { classes: [], methods: [], calls: [] }; |
| 165 | for (const fact of facts) { |
| 166 | if (fact.kind === 'method' || fact.kind === 'function') found.methods.push(fact.name!); |
| 167 | else if (fact.kind === 'calls') { |
| 168 | if (fact.ref) found.calls.push(fact.ref); |
| 169 | } else if (fact.ref !== null) found.classes.push(`${fact.kind} ${fact.owner} ${fact.ref ?? ''}`); |
| 170 | } |
| 171 | return found; |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * The calls edges into a node, out of one, or into any node of a name, from |
no test coverage detected