selfhost: auto-Drop for Array<T> in @[Checked] functions
In @[Checked] functions, variables of type Array<T> automatically get a defer Array_Free_T(&var) injected at declaration site. This ensures Array values are freed when they go out of scope, preventing leaks. Implementation: - HIR lowering detects Array_<T> types in skLet statements - Generates Array_Free_T generic instance if needed - Builds synthetic defer node: defer Array_Free_T(&var) - Wraps let+defer in hBlock for proper statement chaining Also adds checkedFunc flag to HirFunc and CEmitter for future use.
This commit is contained in:
@@ -114,6 +114,7 @@ struct HirFunc {
|
||||
captureType7: int;
|
||||
envStructName: String;
|
||||
envInstanceName: String;
|
||||
checkedFunc: bool;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user