bugfix: inline iterator do not mess up line information anymore

This commit is contained in:
Andreas Rumpf 2017-01-25 09:34:45 +01:00
commit 1fa3a9dac2
2 changed files with 29 additions and 3 deletions

View file

@ -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