made some tests green; htmlgen still broken
This commit is contained in:
parent
3a2e1ce538
commit
b7bb56bdca
4 changed files with 16 additions and 10 deletions
|
|
@ -109,14 +109,18 @@ template decodeBx(k: expr) {.immediate, dirty.} =
|
||||||
template move(a, b: expr) {.immediate, dirty.} = system.shallowCopy(a, b)
|
template move(a, b: expr) {.immediate, dirty.} = system.shallowCopy(a, b)
|
||||||
# XXX fix minor 'shallowCopy' overloading bug in compiler
|
# XXX fix minor 'shallowCopy' overloading bug in compiler
|
||||||
|
|
||||||
template createStrKeepNode(x) =
|
proc createStrKeepNode(x: var TRegister) =
|
||||||
if x.node.isNil:
|
if x.node.isNil:
|
||||||
x.node = newNode(nkStrLit)
|
x.node = newNode(nkStrLit)
|
||||||
elif x.node.kind == nkNilLit:
|
elif x.node.kind == nkNilLit:
|
||||||
system.reset(x.node[])
|
system.reset(x.node[])
|
||||||
x.node.kind = nkStrLit
|
x.node.kind = nkStrLit
|
||||||
else:
|
else:
|
||||||
assert x.node.kind in {nkStrLit..nkTripleStrLit}
|
# XXX this is hacky; tests/txmlgen triggers it:
|
||||||
|
x.node = newNode(nkStrLit)
|
||||||
|
#if x.node.kind notin {nkStrLit..nkTripleStrLit}:
|
||||||
|
# debug x.node
|
||||||
|
#assert x.node.kind in {nkStrLit..nkTripleStrLit}
|
||||||
|
|
||||||
template createStr(x) =
|
template createStr(x) =
|
||||||
x.node = newNode(nkStrLit)
|
x.node = newNode(nkStrLit)
|
||||||
|
|
|
||||||
|
|
@ -924,7 +924,7 @@ proc genAddrDeref(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode;
|
||||||
flags: TGenFlags) =
|
flags: TGenFlags) =
|
||||||
# a nop for certain types
|
# a nop for certain types
|
||||||
let isAddr = opc in {opcAddrNode, opcAddrReg}
|
let isAddr = opc in {opcAddrNode, opcAddrReg}
|
||||||
let flags = if isAddr: flags+{gfAddrOf} else: flags
|
let newflags = if isAddr: flags+{gfAddrOf} else: flags
|
||||||
# consider:
|
# consider:
|
||||||
# proc foo(f: var ref int) =
|
# proc foo(f: var ref int) =
|
||||||
# f = new(int)
|
# f = new(int)
|
||||||
|
|
@ -935,12 +935,14 @@ proc genAddrDeref(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode;
|
||||||
# The type of 'f' is 'var ref int' and of 'x' is 'ref int'. Hence for
|
# The type of 'f' is 'var ref int' and of 'x' is 'ref int'. Hence for
|
||||||
# nkAddr we must not use 'unneededIndirection', but for deref we use it.
|
# nkAddr we must not use 'unneededIndirection', but for deref we use it.
|
||||||
if not isAddr and unneededIndirection(n.sons[0]):
|
if not isAddr and unneededIndirection(n.sons[0]):
|
||||||
gen(c, n.sons[0], dest, flags)
|
gen(c, n.sons[0], dest, newflags)
|
||||||
else:
|
else:
|
||||||
let tmp = c.genx(n.sons[0], flags)
|
let tmp = c.genx(n.sons[0], newflags)
|
||||||
if dest < 0: dest = c.getTemp(n.typ)
|
if dest < 0: dest = c.getTemp(n.typ)
|
||||||
if not isAddr:
|
if not isAddr:
|
||||||
gABC(c, n, opc, dest, tmp)
|
gABC(c, n, opc, dest, tmp)
|
||||||
|
if gfAddrOf notin flags and fitsRegister(n.typ):
|
||||||
|
c.gABC(n, opcNodeToReg, dest, dest)
|
||||||
elif c.prc.slots[tmp].kind >= slotTempUnknown:
|
elif c.prc.slots[tmp].kind >= slotTempUnknown:
|
||||||
gABC(c, n, opcAddrReg, dest, tmp)
|
gABC(c, n, opcAddrReg, dest, tmp)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
line: 10
|
line: 10
|
||||||
errormsg: "value returned by statement has to be discarded"
|
errormsg: "value of type 'bool' has to be discarded"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
proc p =
|
proc p =
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tstmtexp.nim"
|
file: "tstmtexp.nim"
|
||||||
line: 8
|
line: 8
|
||||||
errormsg: "value returned by statement has to be discarded"
|
errormsg: "value of type 'int literal(5)' has to be discarded"
|
||||||
"""
|
"""
|
||||||
# Test 3
|
# Test 3
|
||||||
|
|
||||||
1+4 #ERROR_MSG value returned by statement has to be discarded
|
1+4
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue