summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-01 11:58:24 +0100
committerAraq <rumpf_a@web.de>2015-02-01 11:58:41 +0100
commit903ca78289dc0460e07bd449a972a4d203d9a09b (patch)
tree71ead133004e19aba148bc4ce8e18022dc122825
parenta6082b2a2013a38ec78a07a62cd04b535689aff4 (diff)
downloadNim-903ca78289dc0460e07bd449a972a4d203d9a09b.tar.gz
fixes #1989
-rw-r--r--compiler/vm.nim8
-rw-r--r--compiler/vmdef.nim1
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 7edbb3fd2..b682b4e25 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -1364,9 +1364,11 @@ var
   globalCtx: PCtx
 
 proc setupGlobalCtx(module: PSym) =
-  if globalCtx.isNil: globalCtx = newCtx(module)
-  else: refresh(globalCtx, module)
-  registerAdditionalOps(globalCtx)
+  if globalCtx.isNil:
+    globalCtx = newCtx(module)
+    registerAdditionalOps(globalCtx)
+  else:
+    refresh(globalCtx, module)
 
 proc myOpen(module: PSym): PPassContext =
   #var c = newEvalContext(module, emRepl)
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim
index 3d49cb130..90b9f2517 100644
--- a/compiler/vmdef.nim
+++ b/compiler/vmdef.nim
@@ -213,6 +213,7 @@ proc newCtx*(module: PSym): PCtx =
 proc refresh*(c: PCtx, module: PSym) =
   c.module = module
   c.prc = PProc(blocks: @[])
+  c.loopIterations = MaxLoopIterations
 
 proc registerCallback*(c: PCtx; name: string; callback: VmCallback) =
   c.callbacks.add((name, callback))