MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / whenAt

Function whenAt

src/ui-server/api/flow.ts:453–467  ·  view source on GitHub ↗

The branch label for `edge`'s call site in `siteNode`'s file, or ''.

(
  cg: CodeGraph,
  projectRoot: string,
  cache: Map<string, FileCache>,
  siteNode: Node,
  edge: Edge
)

Source from the content-addressed store, hash-verified

451
452/** The branch label for `edge`'s call site in `siteNode`'s file, or ''. */
453async function whenAt(
454 cg: CodeGraph,
455 projectRoot: string,
456 cache: Map<string, FileCache>,
457 siteNode: Node,
458 edge: Edge
459): Promise<string> {
460 if (!edge.line || !supportsBranchGuards(siteNode.language)) return '';
461 const file = loadFile(cg, projectRoot, cache, siteNode.filePath);
462 if (!file || file.drift || !file.abs) return '';
463 const site = { line: edge.line, column: typeof edge.column === 'number' ? edge.column : null };
464 const guards = await guardsForFile(file.abs, file.language as Language, [site]);
465 const g = guards.get(siteKey(site));
466 return g ? guardLabel(g) : '';
467}
468
469// =============================================================================
470// Building the flows

Callers 1

toWireFlowFunction · 0.70

Calls 6

supportsBranchGuardsFunction · 0.90
guardsForFileFunction · 0.90
siteKeyFunction · 0.90
guardLabelFunction · 0.90
loadFileFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected