feat(compiler): localize array literal range collection#52
Open
feat(compiler): localize array literal range collection#52
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation