newruntime: fixes another bug

This commit is contained in:
Araq 2019-04-10 13:53:47 +02:00
commit a34ce2714a
5 changed files with 247 additions and 4 deletions

View file

@ -425,6 +425,9 @@ proc sinkParamIsLastReadCheck(c: var Con, s: PNode) =
proc passCopyToSink(n: PNode; c: var Con): PNode =
result = newNodeIT(nkStmtListExpr, n.info, n.typ)
let tmp = getTemp(c, n.typ, n.info)
# XXX This is only required if we are in a loop. Since we move temporaries
# out of loops we need to mark it as 'wasMoved'.
result.add genWasMoved(tmp, c)
if hasDestructor(n.typ):
var m = genCopy(c, n.typ, tmp, n)
m.add p(n, c)