From f50575d147132dc6d8d368b7c43f8da81326c814 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 29 Mar 2014 14:47:01 +0100 Subject: [PATCH] fixes #932 --- compiler/lambdalifting.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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.} =