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

Function place

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

* Put an item in its block, opening the run it belongs to: work registered to * run later, and calls started together, are not the sequence they are written * in and say so rather than pretending.

(block: WireBlock, item: WireItem, site: ProgramSite)

Source from the content-addressed store, hash-verified

321 * in and say so rather than pretending.
322 */
323function place(block: WireBlock, item: WireItem, site: ProgramSite): void {
324 const run = runFor(site);
325 if (run === null) {
326 block.push(item);
327 return;
328 }
329 const last = block[block.length - 1];
330 if (last && last.kind === 'block' && last.block === run.block && last.by === run.by) {
331 last.body.push(item);
332 return;
333 }
334 block.push({ kind: 'block', block: run.block, ...(run.by ? { by: run.by } : {}), body: [item] });
335}
336
337/** The run a site belongs to — registered to run later, started together — or null for plain sequence. */
338function runFor(site: ProgramSite): { block: 'later' | 'together'; by?: string } | null {

Callers 1

blockForFunction · 0.70

Calls 2

runForFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected