parent
4982d1c662
commit
6391f6e861
2 changed files with 209 additions and 203 deletions
|
|
@ -1019,7 +1019,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
let nc = regs[rc].node
|
let nc = regs[rc].node
|
||||||
if nb.kind != nc.kind: discard
|
if nb.kind != nc.kind: discard
|
||||||
elif (nb == nc) or (nb.kind == nkNilLit): ret = true # intentional
|
elif (nb == nc) or (nb.kind == nkNilLit): ret = true # intentional
|
||||||
elif sameConstant(nb, nc): ret = true
|
elif (nb.kind in {nkSym, nkTupleConstr, nkClosure} and nb.typ.kind == tyProc) and sameConstant(nb, nc):
|
||||||
|
ret = true
|
||||||
# this also takes care of procvar's, represented as nkTupleConstr, e.g. (nil, nil)
|
# this also takes care of procvar's, represented as nkTupleConstr, e.g. (nil, nil)
|
||||||
elif nb.kind == nkIntLit and nc.kind == nkIntLit and nb.intVal == nc.intVal: # TODO: nkPtrLit
|
elif nb.kind == nkIntLit and nc.kind == nkIntLit and nb.intVal == nc.intVal: # TODO: nkPtrLit
|
||||||
let tb = nb.getTyp
|
let tb = nb.getTyp
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@ discard """
|
||||||
targets: "c js"
|
targets: "c js"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import lists, sequtils
|
import std/[lists, sequtils]
|
||||||
|
|
||||||
const
|
const
|
||||||
data = [1, 2, 3, 4, 5, 6]
|
data = [1, 2, 3, 4, 5, 6]
|
||||||
|
|
||||||
|
|
||||||
|
template main =
|
||||||
block SinglyLinkedListTest1:
|
block SinglyLinkedListTest1:
|
||||||
var L: SinglyLinkedList[int]
|
var L: SinglyLinkedList[int]
|
||||||
for d in items(data): L.prepend(d)
|
for d in items(data): L.prepend(d)
|
||||||
|
|
@ -231,3 +233,6 @@ block remove: # return value check
|
||||||
doAssert l.toSeq == [1]
|
doAssert l.toSeq == [1]
|
||||||
doAssert l.remove(l.head) == true
|
doAssert l.remove(l.head) == true
|
||||||
doAssert l.toSeq == []
|
doAssert l.toSeq == []
|
||||||
|
|
||||||
|
static: main()
|
||||||
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue