diff --git a/compiler/transf.nim b/compiler/transf.nim index 30b05e5a3f..b8c59d5586 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -316,6 +316,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..