Skip to content

feat(compiler): localize array literal range collection#52

Open
thiremani wants to merge 10 commits intomasterfrom
codex/array-literal-local-ranges
Open

feat(compiler): localize array literal range collection#52
thiremani wants to merge 10 commits intomasterfrom
codex/array-literal-local-ranges

Conversation

@thiremani
Copy link
Copy Markdown
Owner

Summary

  • keep array-literal ranges collector-local instead of propagating them into parent expressions
  • reopen nested [] range drivers even when an outer loop shadows the same name
  • update the range semantics spec and end-to-end expectations to match the new model

Validation

  • python3 test.py

Keep array-literal ranges collector-local instead of propagating them into parent expressions. Nested [] now reopen their own range drivers even when an outer loop shadows the same name, while top-level ranged accumulation keeps its existing gate and zero-fill behavior.

Update the range semantics doc and end-to-end coverage to match the new model, including same-driver nested collectors in expression, condition, and print contexts.
Rename the top-level accumulation helper to withPendingLiteralRanges so it reads clearly against collector-local array materialization. This keeps the semantics unchanged and makes the two array-lowering paths easier to distinguish in code review.
Rename the collector-local lookup helper to getRangeDriverSymbol so it reads clearly against getRawSymbol. This keeps behavior unchanged and makes the shadow-skipping lookup intent explicit in loop lowering.
Collapse function iterator bindings into a single IterScope and drop the dead PushIterScope name plumbing.

This keeps collector-local pre-iteration lookup structural while reducing empty scope frames and clarifying why function bodies only add an extra BlockScope when iterator shadows are active.
Move the function-iteration body BlockScope to the funcLoopNest leaf and document the compileBlockWithArgs scope contract.

This keeps the per-level IterScope refactor structurally cleaner without changing behavior.
Rename the collect-owned loop helpers to match CollectRanges and smooth the
nearby lowering comments.

Also restore call/infix/prefix examples in the range semantics doc so the new
stream-and-collection model keeps the useful operator guidance from the older
writeup without reviving the removed base-function rule.
Keep statement-condition drivers shared while leaving sibling RHS drivers local in ranged tuple lowering. Stage per-expression results before committing so later bounds failures cannot make tuple order observable, and document the rule with cond_accum regressions and updated range semantics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant