minor bugfix for transf pass after lambda-lifting
This commit is contained in:
parent
73279aba39
commit
c04e17aea3
1 changed files with 20 additions and 17 deletions
|
|
@ -139,23 +139,26 @@ proc transformVarSection(c: PTransf, v: PNode): PTransNode =
|
||||||
if it.kind == nkCommentStmt:
|
if it.kind == nkCommentStmt:
|
||||||
result[i] = PTransNode(it)
|
result[i] = PTransNode(it)
|
||||||
elif it.kind == nkIdentDefs:
|
elif it.kind == nkIdentDefs:
|
||||||
if it.sons[0].kind != nkSym: internalError(it.info, "transformVarSection")
|
if it.sons[0].kind == nkSym:
|
||||||
internalAssert(it.len == 3)
|
internalAssert(it.len == 3)
|
||||||
var newVar = copySym(it.sons[0].sym)
|
var newVar = copySym(it.sons[0].sym)
|
||||||
incl(newVar.flags, sfFromGeneric)
|
incl(newVar.flags, sfFromGeneric)
|
||||||
# fixes a strange bug for rodgen:
|
# fixes a strange bug for rodgen:
|
||||||
#include(it.sons[0].sym.flags, sfFromGeneric);
|
#include(it.sons[0].sym.flags, sfFromGeneric);
|
||||||
newVar.owner = getCurrOwner(c)
|
newVar.owner = getCurrOwner(c)
|
||||||
idNodeTablePut(c.transCon.mapping, it.sons[0].sym, newSymNode(newVar))
|
idNodeTablePut(c.transCon.mapping, it.sons[0].sym, newSymNode(newVar))
|
||||||
var defs = newTransNode(nkIdentDefs, it.info, 3)
|
var defs = newTransNode(nkIdentDefs, it.info, 3)
|
||||||
if importantComments():
|
if importantComments():
|
||||||
# keep documentation information:
|
# keep documentation information:
|
||||||
PNode(defs).comment = it.comment
|
PNode(defs).comment = it.comment
|
||||||
defs[0] = newSymNode(newVar).PTransNode
|
defs[0] = newSymNode(newVar).PTransNode
|
||||||
defs[1] = it.sons[1].PTransNode
|
defs[1] = it.sons[1].PTransNode
|
||||||
defs[2] = transform(c, it.sons[2])
|
defs[2] = transform(c, it.sons[2])
|
||||||
newVar.ast = defs[2].PNode
|
newVar.ast = defs[2].PNode
|
||||||
result[i] = defs
|
result[i] = defs
|
||||||
|
else:
|
||||||
|
# has been transformed into 'param.x' for closure iterators, so keep it:
|
||||||
|
result[i] = PTransNode(it)
|
||||||
else:
|
else:
|
||||||
if it.kind != nkVarTuple:
|
if it.kind != nkVarTuple:
|
||||||
internalError(it.info, "transformVarSection: not nkVarTuple")
|
internalError(it.info, "transformVarSection: not nkVarTuple")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue