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

Function mergeTails

ui/src/lib/program-model.ts:218–227  ·  view source on GitHub ↗

* Ways on that wait at the same place are one place to go on from. Without * this, an `if` with no `else` — or a fork whose arms draw nothing — doubles * every way it crosses (once under its condition, once without), and a body * with eighty such checks (jsoup's `parse`) never finished: the page

(tails: readonly Tail[])

Source from the content-addressed store, hash-verified

216 * under-claims rather than claims a side it does not have.
217 */
218function mergeTails(tails: readonly Tail[]): Tail[] {
219 const byPlace = new Map<string, Tail>();
220 for (const t of tails) {
221 const key = `${t.id}\0${t.arm ?? ''}\0${t.runs.join('\0')}`;
222 const found = byPlace.get(key);
223 if (found) found.when = found.when.filter((w) => t.when.includes(w));
224 else byPlace.set(key, { ...t, when: [...t.when], runs: [...t.runs] });
225 }
226 return [...byPlace.values()];
227}
228
229/** Whether anything in this block draws a box — a fork with one drawn arm is a guard clause, not a point. */
230function hasStep(block: WireBlock): boolean {

Callers 1

flowFunction · 0.85

Calls 3

getMethod · 0.65
joinMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected