-
Notifications
You must be signed in to change notification settings - Fork 0
v1.0.0 - Expressions, Parsing etc (WIP) #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dhedey
wants to merge
462
commits into
main
Choose a base branch
from
develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…er instead of parse order
This PR implements a comprehensive scoping and binding system for the preinterpret macro language, enabling compile-time analysis of variable lifetimes and ownership. The implementation creates scopes and bindings during parse time, resolves variable references to bindings, and determines if a binding is final to eliminate unnecessary .take_owned() calls.
Key changes:
* Adds scope and control flow analysis at parse time to track variable definitions, references, and their final uses
* Removes the need for explicit .take_owned() calls by automatically detecting when a variable reference is its final use
* Introduces a two-pass parsing system: initial parsing followed by control flow analysis
* Adds support for #{ } embedded statement blocks in stream literals that execute in the parent scope
Command cleanup
…stedValue> - Update all RequestedOwnership::map_from_* methods to: - Take Spanned<X> instead of (X, SpanRange) for consistent span tracking - Return Spanned<RequestedValue> instead of just RequestedValue - Update all ArgumentOwnership::map_from_* methods similarly - Update all callers to wrap values in Spanned and extract .0 where needed - Update evaluator context methods to work with Spanned return values This continues the pattern of keeping spans together with values for better error messages and cleaner API boundaries.
…fields Remove span_range fields from LateBoundOwnedValue and LateBoundSharedValue that were incorrectly added during this PR. Instead, the span is now carried externally via Spanned<LateBoundValue> through the variable resolution chain: - VariableState::resolve returns Spanned<LateBoundValue> - Interpreter::resolve returns Spanned<LateBoundValue> - VariableReference::resolve_late_bound returns Spanned<LateBoundValue> - map_from_late_bound methods take Spanned<LateBoundValue> - resolve() method moved from LateBoundValue to Spanned<LateBoundValue>
…ile loop - Change WhileExpression::evaluate to use a while loop instead of loop - Update context.evaluate to take closure returning Spanned<RequestedValue> - Update context.return_argument_value to take Spanned<ArgumentValue> - Update context.return_returned_value to take Spanned<ReturnedValue> - Update context.return_value to take Spanned<T> - Update context.return_not_necessarily_matching_requested to take Spanned - Add resolve_spanned method to TypeProperty - Make ParseTemplateLiteral implement Evaluate trait - Update all callers to use evaluate_spanned and wrap values in Spanned
… bugs - Make enable(span_range) methods on base types (Mutable, Shared, CopyOnWrite) pub(crate) for internal use by Spanned<ArgumentValue>::enable() - Spanned<T>::enable() delegates to inner type's enable(span_range) - Fix map_from_shared_with_error_reason to take Spanned<SharedValue> and use try_transparent_clone instead of infallible_clone - Fix map_from_mutable_inner to use try_transparent_clone for late-bound values instead of direct clone - Add transparent_clone methods to Spanned<Shared<Value>> and Spanned<Mutable<Value>> - Make MUTABLE_ERROR_MESSAGE and SHARED_ERROR_MESSAGE pub(crate)
- Add into_owned_transparently method to CopyOnWrite<Value> that properly handles SharedWithTransparentCloning by using try_transparent_clone - Add convenience method on Spanned<CopyOnWrite<Value>> - Fix map_from_copy_on_write in ArgumentOwnership to use into_owned_transparently instead of incorrectly using into_owned_infallible This fixes a bug where transparent cloning semantics were being bypassed when converting CopyOnWrite values to owned values.
…nmFvMjZnteoWNkdm6 Refactor Span Ranges Span ranges get moved out to a Spanned<X> instead of being internal to value wrappers. This is the first step towards allowing us to sensibly work with / resolve a Shared<T> for T != Value, which will unblock us to pass sub-values into closures, and unblock the functions/closures mini-project.
Minor: normalize some imports
…rals feat: Add back concatenated literals
…am-literal-misparse feat: Add clarification for %xyz[] misparse
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.
No description provided.