summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2015-12-30 00:47:15 +0100
committerAndreas Rumpf <rumpf_a@web.de>2015-12-30 00:47:15 +0100
commit9cc066d99ddbeffb3e6fdacbe8f9159131bb942c (patch)
tree065abb2b56182d916d373738b5d59b36a0ed9e00
parent250e81cedad70c861bf0b18c12b6f23e79388574 (diff)
downloadNim-9cc066d99ddbeffb3e6fdacbe8f9159131bb942c.tar.gz
closure iterators sometimes work
-rw-r--r--compiler/lambdalifting.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim
index 1467d9594..5bdf73c5f 100644
--- a/compiler/lambdalifting.nim
+++ b/compiler/lambdalifting.nim
@@ -359,7 +359,8 @@ proc detectCapturedVars(n: PNode; owner: PSym; c: var DetectionPass) =
       # create required upFields:
       var w = owner.skipGenericOwner
       if isInnerProc(w):
-        while w != nil and w.kind != skModule and ow != w:
+        let last = if ow.isIterator: ow.skipGenericOwner else: ow
+        while w != nil and w.kind != skModule and last != w:
           discard """
           proc outer =
             var a, b: int
@@ -413,7 +414,7 @@ proc accessViaEnvParam(n: PNode; owner: PSym): PNode =
       let upField = lookupInRecord(obj.n, getIdent(upName))
       if upField == nil: break
       access = rawIndirectAccess(access, upField, n.info)
-  localError(n.info, "internal error: no environment parameter set")
+  localError(n.info, "internal error: environment misses: " & s.name.s)
   result = n
 
 proc rawClosureCreation(env: PNode; owner: PSym;