Add buildScopesInto for a scope table shared across files - #8
Merged
Merged
Conversation
A resolution can span several files: `use <file>` gives each used file its own root Scope, and a used file may itself `use` another. One evaluation reads all of them back, so every node's scope has to land in ONE table. buildScopes() creates a table and attaches it to the root it returns, which is right for a single tree and wrong for that case -- each level built its own table and only the outermost survived, so the evaluation saw no scope at all for a used file's nodes and `use` silently resolved to undef. buildScopesInto() records into a table the caller owns and does not attach it, so a multi-file resolution can thread one through and hand it to the outermost root at the end. buildScopes() is now that plus the allocation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Follow-up to #7, fixing a regression it introduced.
A resolution can span several files:
use <file>gives each used file its own rootScope, and a used file may itselfuseanother. One evaluation reads all of them back, so every node's scope has to land in ONE table.buildScopes()creates a table and attaches it to the root it returns — right for a single tree, wrong for that case. Each level built its own table and only the outermost survived, so the evaluation saw no scope at all for a used file's nodes andusesilently resolved toundef:Fix
buildScopesInto()records into a table the caller owns and does not attach it, so a multi-file resolution can thread one through and hand it to the outermost root at the end.buildScopes()is now that plus the allocation.Verified
usecase that fails without this), 31 binding tests, BelfrySCAD's 1296, BOSL2's 909🤖 Generated with Claude Code