summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-04-07 14:12:08 +0200
committerAraq <rumpf_a@web.de>2013-04-07 14:12:08 +0200
commitf9d4e39a12238d48cd7b8ab461055fe48b989967 (patch)
tree9ea27b2e787233472353b001018720e6c84e333d /compiler
parent0b1630b46c9ab8ba5acb82bc04b998961cef4973 (diff)
downloadNim-f9d4e39a12238d48cd7b8ab461055fe48b989967.tar.gz
bugfix evals.nim
Diffstat (limited to 'compiler')
-rw-r--r--compiler/evals.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/evals.nim b/compiler/evals.nim
index 66b8de3d0..968170e85 100644
--- a/compiler/evals.nim
+++ b/compiler/evals.nim
@@ -295,8 +295,9 @@ proc evalVar(c: PEvalContext, n: PNode): PNode =
     # XXX var (x, y) = z support?
     #assert(a.sons[0].kind == nkSym) can happen for transformed vars
     if a.sons[2].kind != nkEmpty:
-      # XXX copyTree could be avoided in some cases
-      result = evalAux(c, a.sons[2], {}).copyTree
+      result = evalAux(c, a.sons[2], {})
+      if result.kind in {nkType..nkNilLit}: 
+        result = result.copyNode
       if isSpecial(result): return
     else:
       result = getNullValue(a.sons[0].typ, a.sons[0].info)