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

Function seal

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

* How each arm ends, decided after its body is known: an arm whose last item * answers the request ends with the reply — the strongest thing a reader can * be told about an endpoint's arm — and otherwise the arm keeps how its code * leaves, read at the site.

(input: ProgramInput, block: WireBlock)

Source from the content-addressed store, hash-verified

377 * leaves, read at the site.
378 */
379function seal(input: ProgramInput, block: WireBlock): void {
380 for (const item of block) {
381 if (item.kind === 'fork') {
382 // A switch's head is the thing being decided on, which only its arms
383 // together say: every case was written `<subject> === <value>`.
384 if (item.form === 'switch') item.on = subjectOf(item.arms.map((a) => a.when));
385 for (const arm of item.arms) {
386 seal(input, arm.body);
387 if (repliesLast(input, arm.body)) arm.ends = 'reply';
388 }
389 } else if (item.kind === 'block') seal(input, item.body);
390 else if (item.kind === 'step' && item.body) seal(input, item.body);
391 }
392}
393
394/**
395 * What every arm of a switch is deciding on: the longest start they share, cut

Callers 1

blockForFunction · 0.85

Calls 3

subjectOfFunction · 0.85
repliesLastFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected