fixes a long standing codegen bug concerning closures

This commit is contained in:
Andreas Rumpf 2016-01-13 16:06:31 +01:00
commit 15c63b8011

View file

@ -1838,8 +1838,8 @@ proc genClosure(p: BProc, n: PNode, d: var TLoc) =
assert n.kind == nkClosure assert n.kind == nkClosure
if isConstClosure(n): if isConstClosure(n):
inc(p.labels) inc(p.module.labels)
var tmp = "LOC" & rope(p.labels) var tmp = "LOC" & rope(p.module.labels)
addf(p.module.s[cfsData], "NIM_CONST $1 $2 = $3;$n", addf(p.module.s[cfsData], "NIM_CONST $1 $2 = $3;$n",
[getTypeDesc(p.module, n.typ), tmp, genConstExpr(p, n)]) [getTypeDesc(p.module, n.typ), tmp, genConstExpr(p, n)])
putIntoDest(p, d, n.typ, tmp, OnStatic) putIntoDest(p, d, n.typ, tmp, OnStatic)