diff --git a/compiler/transf.nim b/compiler/transf.nim index 24363cad0b..0a28fd1a05 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -324,6 +324,14 @@ proc introduceNewLocalVars(c: PTransf, n: PNode): PNode = if a.kind == nkSym: n[1] = transformSymAux(c, a) return n + of nkProcDef: # todo optimize nosideeffects? + result = newTransNode(n) + let x = freshVar(c, n[namePos].sym) + idNodeTablePut(c.transCon.mapping, n[namePos].sym, x) + result[namePos] = x # we have to copy proc definitions for iters + for i in 1..