Develop#20
Merged
TheUncharted merged 3 commits intomasterfrom Mar 12, 2026
Merged
Conversation
The VM uses value semantics for objects, so calling a method like c.increment() would clone the receiver. Mutations to this.count inside the method modified the clone but never wrote back to the original variable, causing repeated calls to always see the same initial state (e.g. [11, 11, 11] instead of [11, 12, 13]). Track receiver provenance (global/local slot) through the LoadGlobal/LoadLocal -> GetProperty -> Call chain, and on Return write the mutated this back to the source variable.
Contributor
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe changes implement method receiver source tracking and mutation persistence across VM frames. A new ReceiverSource enum tracks whether a method receiver originates from global or local variables. The VM preserves receiver source through frame transitions and writes back mutations to the original source upon method return. Tests validate this behavior. Package dependencies are updated to latest versions across example projects. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant VM
participant CallFrame
participant Store
Client->>VM: Load receiver object (Global/Local)
VM->>VM: Capture receiver source (ReceiverSource)
Client->>VM: Call method on receiver
VM->>CallFrame: Push new frame<br/>(with receiver_source)
CallFrame->>CallFrame: Execute method body<br/>(mutate this)
Client->>VM: Return from method
VM->>Store: Write mutated this back<br/>to original source<br/>(Global or Local)
VM->>VM: Clear receiver_source
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Contributor
Benchmark Results |
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
Changes
Test plan
cargo test)Related issues
Summary by CodeRabbit
Bug Fixes
this. Changes made to instance state within methods are now properly persisted and written back to the original receiver, ensuring mutations remain consistent across method calls.Chores