summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-01-25 09:34:45 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-01-25 09:34:51 +0100
commit1fa3a9dac25e982624164898d98f22565c16d566 (patch)
tree4cbcf4b3f843b34a767abf1e0a2305363f2893d4 /compiler
parentc7e54eba91e31091a40dfa6d96a7a323db63b933 (diff)
downloadNim-1fa3a9dac25e982624164898d98f22565c16d566.tar.gz
bugfix: inline iterator do not mess up line information anymore
Diffstat (limited to 'compiler')
-rw-r--r--compiler/transf.nim10
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