fixes all known regressions

This commit is contained in:
Andreas Rumpf 2016-01-06 11:26:52 +01:00
commit 98cc99cbcf
3 changed files with 18 additions and 20 deletions

View file

@ -751,12 +751,12 @@ proc liftLambdas*(fn: PSym, body: PNode; tooEarly: var bool): PNode =
tooEarly = true
else:
var d = initDetectionPass(fn)
var c = initLiftingPass(fn)
detectCapturedVars(body, fn, d)
if not d.somethingToDo and fn.isIterator:
addClosureParam(d, fn)
d.somethingToDo = true
if d.somethingToDo:
var c = initLiftingPass(fn)
var newBody = liftCapturedVars(body, fn, d, c)
if c.envvars.getOrDefault(fn.id) != nil:
newBody = newTree(nkStmtList, rawClosureCreation(fn, d, c), newBody)