* The branch conditions a flow hop's call site runs under, read from the * caller's source now (`graph/branch-guards.ts`); '' when unconditional, * unreadable, or the grammar for that language is not loaded.
(cg: CodeGraph, caller: Node, edge: Edge)
| 3676 | * unreadable, or the grammar for that language is not loaded. |
| 3677 | */ |
| 3678 | private whenLabel(cg: CodeGraph, caller: Node, edge: Edge): string { |
| 3679 | if (!edge.line || !supportsBranchGuards(caller.language)) return ''; |
| 3680 | try { |
| 3681 | const rec = cg.getFile(caller.filePath); |
| 3682 | if (!rec) return ''; |
| 3683 | const abs = validatePathWithinRoot(cg.getProjectRoot(), caller.filePath); |
| 3684 | if (!abs) return ''; |
| 3685 | const st = statSync(abs); |
| 3686 | // Drifted since the index: the recorded line may point elsewhere. |
| 3687 | if (st.size !== rec.size || Math.floor(st.mtimeMs) !== Math.floor(rec.modifiedAt)) return ''; |
| 3688 | const site = { line: edge.line, column: typeof edge.column === 'number' ? edge.column : null }; |
| 3689 | const g = guardsForFileSync(abs, caller.language, [site]).get(siteKey(site)); |
| 3690 | return g ? guardLabel(g) : ''; |
| 3691 | } catch { |
| 3692 | return ''; |
| 3693 | } |
| 3694 | } |
| 3695 | |
| 3696 | /** |
| 3697 | * The tag a synthesized (dynamic-dispatch) hop carries in explore's Flow and |
no test coverage detected