diff options
author | Araq <rumpf_a@web.de> | 2014-03-29 14:47:01 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-03-29 14:47:01 +0100 |
commit | f50575d147132dc6d8d368b7c43f8da81326c814 (patch) | |
tree | 68d096c4ea178922c32b82504cf1365caefba76f /compiler/lambdalifting.nim | |
parent | b6d5f18c9345c0000bf4f87dc455b3aa3946811d (diff) | |
download | Nim-f50575d147132dc6d8d368b7c43f8da81326c814.tar.gz |
fixes #932
Diffstat (limited to 'compiler/lambdalifting.nim')
-rw-r--r-- | compiler/lambdalifting.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index 6f6942096..6da156ba6 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -356,7 +356,10 @@ proc captureVar(o: POuterContext, i: PInnerContext, local: PSym, # it's in some upper environment: access = indirectAccess(access, addDep(e, it, i.fn), info) access = indirectAccess(access, local, info) - incl(o.capturedVars, local.id) + if o.isIter: + if not containsOrIncl(o.capturedVars, local.id): addField(o.tup, local) + else: + incl(o.capturedVars, local.id) idNodeTablePut(i.localsToAccess, local, access) proc interestingVar(s: PSym): bool {.inline.} = |