diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-06-23 04:17:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-22 22:17:23 +0200 |
commit | 88114948c41f38d7366dc8d80abc09f00c2492fa (patch) | |
tree | 848d685b344c63cff130c19a8d8f013a523e95c3 /compiler | |
parent | d137a3b52af1a83cd9617e47b63d7b3d6c4d935b (diff) | |
download | Nim-88114948c41f38d7366dc8d80abc09f00c2492fa.tar.gz |
fixes #21110; duplicate proc definitions for inline iters (#21136)
fixes #21110; duplicate proc definitions for iters
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/transf.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim index 24363cad0..0a28fd1a0 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..<n.len: + result[i] = introduceNewLocalVars(c, n[i]) + result[namePos].sym.ast = result else: result = newTransNode(n) for i in 0..<n.len: |