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:
parent
695154970d
commit
1854d29781
17 changed files with 611 additions and 477 deletions
|
|
@ -173,3 +173,39 @@ proc bug14495 =
|
|||
echo o[]
|
||||
|
||||
bug14495()
|
||||
|
||||
when false:
|
||||
# bug #14396
|
||||
type
|
||||
Spinny = ref object
|
||||
t: ref int
|
||||
text: string
|
||||
|
||||
proc newSpinny*(): Spinny =
|
||||
Spinny(t: new(int), text: "hello")
|
||||
|
||||
proc spinnyLoop(x: ref int, spinny: sink Spinny) =
|
||||
echo x[]
|
||||
|
||||
proc start*(spinny: sink Spinny) =
|
||||
spinnyLoop(spinny.t, spinny)
|
||||
|
||||
var spinner1 = newSpinny()
|
||||
spinner1.start()
|
||||
|
||||
# bug #14345
|
||||
|
||||
type
|
||||
SimpleLoopB = ref object
|
||||
children: seq[SimpleLoopB]
|
||||
parent: SimpleLoopB
|
||||
|
||||
proc addChildLoop(self: SimpleLoopB, loop: SimpleLoopB) =
|
||||
self.children.add loop
|
||||
|
||||
proc setParent(self: SimpleLoopB, parent: SimpleLoopB) =
|
||||
self.parent = parent
|
||||
self.parent.addChildLoop(self)
|
||||
|
||||
var l = SimpleLoopB()
|
||||
l.setParent(l)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue