fixes a tuple lowering bug
This commit is contained in:
parent
9e88cf8ac9
commit
e0f109d373
1 changed files with 4 additions and 3 deletions
|
|
@ -51,13 +51,14 @@ proc lowerTupleUnpacking*(n: PNode; owner: PSym): PNode =
|
||||||
incl(temp.flags, sfFromGeneric)
|
incl(temp.flags, sfFromGeneric)
|
||||||
|
|
||||||
var v = newNodeI(nkVarSection, value.info)
|
var v = newNodeI(nkVarSection, value.info)
|
||||||
v.addVar(newSymNode(temp))
|
let tempAsNode = newSymNode(temp)
|
||||||
|
v.addVar(tempAsNode)
|
||||||
result.add(v)
|
result.add(v)
|
||||||
|
|
||||||
result.add newAsgnStmt(newSymNode(temp), value)
|
result.add newAsgnStmt(tempAsNode, value)
|
||||||
for i in 0 .. n.len-3:
|
for i in 0 .. n.len-3:
|
||||||
if n.sons[i].kind == nkSym: v.addVar(n.sons[i])
|
if n.sons[i].kind == nkSym: v.addVar(n.sons[i])
|
||||||
result.add newAsgnStmt(n.sons[i], newTupleAccess(value, i))
|
result.add newAsgnStmt(n.sons[i], newTupleAccess(tempAsNode, i))
|
||||||
|
|
||||||
proc createObj*(owner: PSym, info: TLineInfo): PType =
|
proc createObj*(owner: PSym, info: TLineInfo): PType =
|
||||||
result = newType(tyObject, owner)
|
result = newType(tyObject, owner)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue