scoped memory management (#14790)

* fixes the regressions
* closes #13936
* scope based memory management implemented
* enabled tcontrolflow.nim test case
* final cleanups
This commit is contained in:
Andreas Rumpf 2020-07-04 07:37:24 +02:00 • committed by GitHub
commit 1854d29781
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 611 additions and 477 deletions

View file

@ -14,7 +14,7 @@ type
p: int
MyObjRef = ref MyObj
proc `=destroy`(x: var MyObj) =
proc `=destroy`(x: var MyObj) =
if x.p != 0:
echo "destroyed"
@ -48,16 +48,16 @@ proc thread5(x: sink MyObjRef): MyObjRef =
os.sleep(1000)
result = x
proc ref_forwarding_test =
proc ref_forwarding_test =
var x = new(MyObj)
x[].p = 2
var y = spawn thread4(x)
proc ref_sink_forwarding_test =
proc ref_sink_forwarding_test =
var x = new(MyObj)
x[].p = 2
var y = spawn thread5(x)
ref_forwarding_test()
ref_sink_forwarding_test()
ref_sink_forwarding_test()
sync()