diff options
author | cooldome <ariabushenko@gmail.com> | 2020-10-23 10:14:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-23 11:14:54 +0200 |
commit | ae320b4e7dfd07ed6ae85a2693da3bb8568520c6 (patch) | |
tree | d6f2b62cce9ac2738b34a4159d47103bf08a6095 /compiler | |
parent | 275354709d2a5e38b9e06b2cee823ddef756d62d (diff) | |
download | Nim-ae320b4e7dfd07ed6ae85a2693da3bb8568520c6.tar.gz |
fix #15662 (#15678)
* fix #15662 * alternative fix * fix spacing
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/vmgen.nim | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 6f81c6a9c..4dcd01458 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -586,9 +586,6 @@ proc genCall(c: PCtx; n: PNode; dest: var TDest) = # varargs need 'opcSetType' for the FFI support: let fntyp = skipTypes(n[0].typ, abstractInst) for i in 0..<n.len: - #if i > 0 and i < fntyp.len: - # let paramType = fntyp.n[i] - # if paramType.typ.isCompileTimeOnly: continue var r: TRegister = x+i c.gen(n[i], r, {gfIsParam}) if i >= fntyp.len: @@ -1926,20 +1923,21 @@ proc genObjConstr(c: PCtx, n: PNode, dest: var TDest) = proc genTupleConstr(c: PCtx, n: PNode, dest: var TDest) = if dest < 0: dest = c.getTemp(n.typ) - c.gABx(n, opcLdNull, dest, c.genType(n.typ)) - # XXX x = (x.old, 22) produces wrong code ... stupid self assignments - for i in 0..<n.len: - let it = n[i] - if it.kind == nkExprColonExpr: - let idx = genField(c, it[0]) - let tmp = c.genx(it[1]) - c.preventFalseAlias(it[1], opcWrObj, - dest, idx, tmp) - c.freeTemp(tmp) - else: - let tmp = c.genx(it) - c.preventFalseAlias(it, opcWrObj, dest, i.TRegister, tmp) - c.freeTemp(tmp) + if n.typ.kind != tyTypeDesc: + c.gABx(n, opcLdNull, dest, c.genType(n.typ)) + # XXX x = (x.old, 22) produces wrong code ... stupid self assignments + for i in 0..<n.len: + let it = n[i] + if it.kind == nkExprColonExpr: + let idx = genField(c, it[0]) + let tmp = c.genx(it[1]) + c.preventFalseAlias(it[1], opcWrObj, + dest, idx, tmp) + c.freeTemp(tmp) + else: + let tmp = c.genx(it) + c.preventFalseAlias(it, opcWrObj, dest, i.TRegister, tmp) + c.freeTemp(tmp) proc genProc*(c: PCtx; s: PSym): int |