further steps for closure support

This commit is contained in:
Araq 2012-02-08 09:10:59 +01:00
commit 2c4a1dbc0c
7 changed files with 101 additions and 57 deletions

View file

@ -578,6 +578,7 @@ proc closureSetup(p: BProc, prc: PSym) =
if prc.typ.callConv != ccClosure: return
# prc.ast[paramsPos].last contains the type we're after:
var env = lastSon(prc.ast[paramsPos]).sym
#echo "created environment: ", env.id, " for ", prc.name.s
assignLocalVar(p, env)
# generate cast assignment:
appcg(p, cpsStmts, "$1 = ($2) ClEnv;$n", rdLoc(env.loc),