summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-02-24 13:26:04 +0100
committerAraq <rumpf_a@web.de>2013-02-24 13:26:04 +0100
commitb4232a672f2d0c80d95d90f943a62956e764683d (patch)
tree099cc73a5354c5a84ba67348e5758cbfe8aa1197
parentc87e1c96ad1c22c3d051bbf7254e7a92360116b6 (diff)
downloadNim-b4232a672f2d0c80d95d90f943a62956e764683d.tar.gz
don't eval wrong code
-rwxr-xr-xcompiler/evals.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/evals.nim b/compiler/evals.nim
index c6e0e947f..d9b03137d 100755
--- a/compiler/evals.nim
+++ b/compiler/evals.nim
@@ -1495,7 +1495,13 @@ proc myOpen(module: PSym): PPassContext =
   pushStackFrame(c, newStackFrame())
   result = c
 
-proc myProcess(c: PPassContext, n: PNode): PNode = 
+var oldErrorCount: int
+
+proc myProcess(c: PPassContext, n: PNode): PNode =
+  # don't eval errornous code:
+  if oldErrorCount != msgs.gErrorCounter:
+    oldErrorCount = msgs.gErrorCounter
+    return n
   result = eval(PEvalContext(c), n)
 
 const evalPass* = makePass(myOpen, nil, myProcess, myProcess)