minor bugfix

This commit is contained in:
Andreas Rumpf 2016-01-04 14:47:46 +01:00
commit 290b7e117e

View file

@ -381,7 +381,7 @@ proc detectCapturedVars(n: PNode; owner: PSym; c: var DetectionPass) =
c.somethingToDo = true c.somethingToDo = true
markAsClosure(owner, n) markAsClosure(owner, n)
addClosureParam(c, owner) addClosureParam(c, owner)
#echo "captureing ", n.info #echo "capturing ", n.info
# variable 's' is actually captured: # variable 's' is actually captured:
if interestingVar(s) and not c.capturedVars.containsOrIncl(s.id): if interestingVar(s) and not c.capturedVars.containsOrIncl(s.id):
let obj = c.getEnvTypeForOwner(ow).lastSon let obj = c.getEnvTypeForOwner(ow).lastSon
@ -433,7 +433,7 @@ proc initLiftingPass(fn: PSym): LiftingPass =
proc accessViaEnvParam(n: PNode; owner: PSym): PNode = proc accessViaEnvParam(n: PNode; owner: PSym): PNode =
let s = n.sym let s = n.sym
# Type based expression construction for simplicity: # Type based expression construction for simplicity:
let envParam = getEnvParam(owner) let envParam = getHiddenParam(owner)
if not envParam.isNil: if not envParam.isNil:
var access = newSymNode(envParam) var access = newSymNode(envParam)
while true: while true:
@ -683,7 +683,7 @@ proc liftCapturedVars(n: PNode; owner: PSym; d: DetectionPass;
elif s.id in d.capturedVars: elif s.id in d.capturedVars:
if s.owner != owner: if s.owner != owner:
result = accessViaEnvParam(n, owner) result = accessViaEnvParam(n, owner)
elif owner.kind == skIterator and interestingIterVar(s): elif owner.isIterator and interestingIterVar(s):
result = accessViaEnvParam(n, owner) result = accessViaEnvParam(n, owner)
else: else:
result = accessViaEnvVar(n, owner, d, c) result = accessViaEnvVar(n, owner, d, c)