fixes #537
This commit is contained in:
parent
6d9177c6f1
commit
e73fd64f38
3 changed files with 28 additions and 10 deletions
|
|
@ -374,7 +374,7 @@ proc canonValue*(n: PNode): PNode =
|
|||
|
||||
proc rawGenLiteral(c: PCtx; n: PNode): int =
|
||||
result = c.constants.len
|
||||
assert(n.kind != nkCall)
|
||||
#assert(n.kind != nkCall)
|
||||
n.flags.incl nfAllConst
|
||||
c.constants.add n.canonValue
|
||||
internalAssert result < 0x7fff
|
||||
|
|
@ -497,7 +497,22 @@ proc genReturn(c: PCtx; n: PNode) =
|
|||
gen(c, n.sons[0])
|
||||
c.gABC(n, opcRet)
|
||||
|
||||
|
||||
proc genLit(c: PCtx; n: PNode; dest: var TDest) =
|
||||
# opcLdConst is now always valid. We produce the necessary copy in the
|
||||
# assignments now:
|
||||
#var opc = opcLdConst
|
||||
if dest < 0: dest = c.getTemp(n.typ)
|
||||
#elif c.prc.slots[dest].kind == slotFixedVar: opc = opcAsgnConst
|
||||
let lit = genLiteral(c, n)
|
||||
c.gABx(n, opcLdConst, dest, lit)
|
||||
|
||||
proc genCall(c: PCtx; n: PNode; dest: var TDest) =
|
||||
# it can happen that due to inlining we have a 'n' that should be
|
||||
# treated as a constant (see issue #537).
|
||||
#if n.typ != nil and n.typ.sym != nil and n.typ.sym.magic == mPNimrodNode:
|
||||
# genLit(c, n, dest)
|
||||
# return
|
||||
if dest < 0 and not isEmptyType(n.typ): dest = getTemp(c, n.typ)
|
||||
let x = c.getTempRange(n.len, slotTempUnknown)
|
||||
# varargs need 'opcSetType' for the FFI support:
|
||||
|
|
@ -1307,15 +1322,6 @@ proc genAsgn(c: PCtx; le, ri: PNode; requiresCopy: bool) =
|
|||
let dest = c.genx(le, {gfAddrOf})
|
||||
genAsgn(c, dest, ri, requiresCopy)
|
||||
|
||||
proc genLit(c: PCtx; n: PNode; dest: var TDest) =
|
||||
# opcLdConst is now always valid. We produce the necessary copy in the
|
||||
# assignments now:
|
||||
#var opc = opcLdConst
|
||||
if dest < 0: dest = c.getTemp(n.typ)
|
||||
#elif c.prc.slots[dest].kind == slotFixedVar: opc = opcAsgnConst
|
||||
let lit = genLiteral(c, n)
|
||||
c.gABx(n, opcLdConst, dest, lit)
|
||||
|
||||
proc genTypeLit(c: PCtx; t: PType; dest: var TDest) =
|
||||
var n = newNode(nkType)
|
||||
n.typ = t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue