* 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)
| 3840 | * unreadable, or the grammar for that language is not loaded. |
| 3841 | */ |
| 3842 | private whenLabel(cg: CodeGraph, caller: Node, edge: Edge): string { |
| 3843 | if (!edge.line || !supportsBranchGuards(caller.language)) return ''; |
| 3844 | try { |
| 3845 | const rec = cg.getFile(caller.filePath); |
| 3846 | if (!rec) return ''; |
| 3847 | const abs = validatePathWithinRoot(cg.getProjectRoot(), caller.filePath); |
| 3848 | if (!abs) return ''; |
| 3849 | const st = statSync(abs); |
| 3850 | // Drifted since the index: the recorded line may point elsewhere. |
| 3851 | if (st.size !== rec.size || Math.floor(st.mtimeMs) !== Math.floor(rec.modifiedAt)) return ''; |
| 3852 | const site = { line: edge.line, column: typeof edge.column === 'number' ? edge.column : null }; |
| 3853 | const g = guardsForFileSync(abs, caller.language, [site]).get(siteKey(site)); |
| 3854 | return g ? guardLabel(g) : ''; |
| 3855 | } catch { |
| 3856 | return ''; |
| 3857 | } |
| 3858 | } |
| 3859 | |
| 3860 | /** |
| 3861 | * The tag a synthesized (dynamic-dispatch) hop carries in explore's Flow and |
no test coverage detected