From 903ca78289dc0460e07bd449a972a4d203d9a09b Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 1 Feb 2015 11:58:24 +0100 Subject: [PATCH] fixes #1989 --- compiler/vm.nim | 8 +++++--- compiler/vmdef.nim | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/vm.nim b/compiler/vm.nim index 7edbb3fd20..b682b4e253 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 3d49cb130d..90b9f2517a 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))