fixes a closure iterator memory leaks, progress on #15076

This commit is contained in:
Araq 2020-07-27 11:44:12 +02:00 • committed by Andreas Rumpf
commit 318f0992ea
2 changed files with 37 additions and 1 deletions

View file

@ -787,7 +787,7 @@ proc p(n: PNode; c: var Con; s: var Scope; mode: ProcessMode): PNode =
if ri.kind == nkEmpty and c.inLoop > 0:
ri = genDefaultCall(v.typ, c, v.info)
if ri.kind != nkEmpty:
result.add moveOrCopy(v, ri, c, s, isDecl = true)
result.add moveOrCopy(v, ri, c, s, isDecl = false)
else: # keep the var but transform 'ri':
var v = copyNode(n)
var itCopy = copyNode(it)