Commit Graph
2 Commits
Author SHA1 Message Date
adrien 439cc6e7ba feat: loop support via goto labels on each block
- Every block now emits a C label (its id) before its code
- generateNextCode emits goto label; for back-edges (visited targets)
- _emitBranch delegates to generateCode (not generateOwnCode), so labels
  are emitted consistently in both main and branch traversals
- generateCallWithError threads a shared visited set across all three
  emitBranch calls, preventing duplicate label emission for shared blocks
- emitBranch skips roots already visited by previous roots in the same
  branch (prevents spurious gotos from shared-block traversal)
2026-06-23 01:16:14 +02:00
adrien f1eed2d4e0 refactor: extract pure codegen into shared module, remove duplication
- Create codegen/index.js with pure branchDescendants, emitBranch,
  generateCallWithError, and generateCFile — zero DOM dependencies
- blocks-proc.js adapters delegate to CodeGen with browser instanceof check
- run.js uses the same CodeGen module instead of duplicating block classes
  with their own branchDescendants/emitBranch logic
- Load codegen/index.js in browser before blocks-proc.js
2026-06-23 01:07:08 +02:00