summary refs log tree commit diff stats
path: root/lib/core
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 /lib/core
parent0b1630b46c9ab8ba5acb82bc04b998961cef4973 (diff)
downloadNim-f9d4e39a12238d48cd7b8ab461055fe48b989967.tar.gz
bugfix evals.nim
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/macros.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 6f4d75b9b..4598fa9ea 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -333,9 +333,11 @@ proc nestList*(theProc: TNimrodIdent,
   ## ``[a, b, c]`` is transformed into ``theProc(a, theProc(c, d))``.
   var L = x.len
   result = newCall(theProc, x[L-2], x[L-1])
-  var a = result
   for i in countdown(L-3, 0):
-    a = newCall(theProc, x[i], copyNimTree(a))
+    # XXX the 'copyNimTree' here is necessary due to a bug in the evaluation
+    # engine that would otherwise create an endless loop here. :-(
+    # This could easily user code and so should be fixed in evals.nim somehow.
+    result = newCall(theProc, x[i], copyNimTree(result))
 
 proc treeRepr*(n: PNimrodNode): string {.compileTime.} =
   ## Convert the AST `n` to a human-readable tree-like string.