-
Notifications
You must be signed in to change notification settings - Fork 3
fix(as): init unmanaged class #26
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
Conversation
|
@HerrCai0907 Can't request reviewers |
HerrCai0907
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. please add test case for this cases,
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
WalkthroughAdjusted compiler’s constructor field initialization logic: zero-initialization optimization now applies only under Runtime.Incremental. Unified handling of non-parameter field initializers using a computed valueExpr and a single setter call path, with special handling for unmanaged classes. Updated WAT test to reflect explicit setter calls for unmanaged objects. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Ctor as Unmanaged#constructor
participant Heap as Runtime/Allocator
participant SetBar as Unmanaged#set:bar
participant SetBaz as Unmanaged#set:baz
Caller->>Ctor: new Unmanaged(...)
Ctor->>Heap: allocate instance (if needed)
Note over Ctor: Unified init: valueExpr = initializer or zero
alt Class is unmanaged
Ctor->>SetBar: set(0)
SetBar-->>Ctor: ok
Ctor->>SetBaz: set(0)
SetBaz-->>Ctor: ok
else Class is managed
alt Runtime.Incremental AND init is const zero
Note over Ctor: Skip zero-initialization (optimized)
else
Ctor->>SetBar: set(valueExpr as needed)
Ctor->>SetBaz: set(valueExpr as needed)
end
end
Ctor-->>Caller: instance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
Comment |
AssemblyScript/assemblyscript#2948
Summary by CodeRabbit
Bug Fixes
Tests