diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-01-25 09:34:45 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-01-25 09:34:51 +0100 |
commit | 1fa3a9dac25e982624164898d98f22565c16d566 (patch) | |
tree | 4cbcf4b3f843b34a767abf1e0a2305363f2893d4 /compiler | |
parent | c7e54eba91e31091a40dfa6d96a7a323db63b933 (diff) | |
download | Nim-1fa3a9dac25e982624164898d98f22565c16d566.tar.gz |
bugfix: inline iterator do not mess up line information anymore
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/transf.nim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim index 4208c43e5..6eed17b2a 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -133,13 +133,17 @@ proc transformSymAux(c: PTransf, n: PNode): PNode = # simply exchange the symbol: b = s.getBody if b.kind != nkSym: internalError(n.info, "wrong AST for borrowed symbol") - b = newSymNode(b.sym) - b.info = n.info + b = newSymNode(b.sym, n.info) else: b = n while tc != nil: result = idNodeTableGet(tc.mapping, b.sym) - if result != nil: return + if result != nil: + # this slightly convoluted way ensures the line info stays correct: + if result.kind == nkSym: + result = copyNode(result) + result.info = n.info + return tc = tc.next result = b |