(fnId: string, at: { line?: number; column?: number }, of: string)
| 729 | Array<{ start: { line: number; column: number }; end: { line: number; column: number }; step: StepRecord }> |
| 730 | >(); |
| 731 | const firedByEffect = (fnId: string, at: { line?: number; column?: number }, of: string): StepRecord | null => { |
| 732 | if (at.line === undefined) return null; |
| 733 | const spans = firedSpans.get(fnId); |
| 734 | if (!spans) return null; |
| 735 | const last = (n: string) => n.replace(/\([^()]*\)/g, '').split(/[.:]/).pop() ?? n; |
| 736 | const want = last(of); |
| 737 | const line = at.line; |
| 738 | const column = at.column ?? 0; |
| 739 | let best: (typeof spans)[number] | null = null; |
| 740 | for (const s of spans) { |
| 741 | if (line < s.start.line || line > s.end.line) continue; |
| 742 | if (line === s.start.line && column < s.start.column) continue; |
| 743 | if (line === s.end.line && column > s.end.column) continue; |
| 744 | if (!s.step.effect?.apis.some((api) => last(api) === want)) continue; |
| 745 | if (best === null || s.start.line > best.start.line || (s.start.line === best.start.line && s.start.column > best.start.column)) { |
| 746 | best = s; |
| 747 | } |
| 748 | } |
| 749 | return best?.step ?? null; |
| 750 | }; |
| 751 | |
| 752 | const stepFor = (node: Node, kind: WireStepKind, depth: number, extra: Partial<WireStep> = {}): StepRecord | null => { |
| 753 | const existing = steps.get(node.id); |
no test coverage detected