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

Function armFor

src/ui-server/api/program.ts:346–353  ·  view source on GitHub ↗

An arm of a fork by its condition, reusing the one already open for it.

(fork: Extract<WireItem, { kind: 'fork' }>, g: BranchGuard)

Source from the content-addressed store, hash-verified

344
345/** An arm of a fork by its condition, reusing the one already open for it. */
346function armFor(fork: Extract<WireItem, { kind: 'fork' }>, g: BranchGuard): WireArm {
347 const when = guardLabel([g]);
348 const found = fork.arms.find((a) => a.when === when);
349 if (found) return found;
350 const arm: WireArm = { when, ...(g.negated ? { not: true as const } : {}), ends: g.armExit ?? null, body: [] };
351 fork.arms.push(arm);
352 return arm;
353}
354
355/** `!` and the condition — the arm, not the decision: an `if` and its `else` differ here and nowhere else. */
356function armKey(g: BranchGuard): string {

Callers 2

blockForFunction · 0.85
openScopeFunction · 0.85

Calls 2

guardLabelFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected