feat: improve borrow checker — reinitialization, assignment move, return move
- Add isOwn field to Symbol for tracking own T declarations - Reinitialization after move: assigning to a moved variable removes it from movedVars - Move tracking in let/var initialization: var b: own Box = a moves a - Move tracking in assignment: x = y moves y if y is own T - Move tracking in return: return x moves x if x is own T - Expand borrow_test.nim to 10 tests (all passing)
This commit is contained in:
@@ -16,6 +16,7 @@ type
|
||||
decl*: Decl ## optional back-reference to AST decl
|
||||
isMutable*: bool
|
||||
isPublic*: bool
|
||||
isOwn*: bool ## true if declared as own T
|
||||
|
||||
Scope* = ref object
|
||||
parent*: Scope
|
||||
|
||||
Reference in New Issue
Block a user