parent
0a14b3d198
commit
d146045ed5
2 changed files with 24 additions and 3 deletions
|
|
@ -1211,8 +1211,14 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
of opcIsNil:
|
of opcIsNil:
|
||||||
decodeB(rkInt)
|
decodeB(rkInt)
|
||||||
let node = regs[rb].node
|
let node = regs[rb].node
|
||||||
regs[ra].intVal = ord(node.kind == nkNilLit or
|
regs[ra].intVal = ord(
|
||||||
(node.kind in {nkStrLit..nkTripleStrLit} and node.strVal.isNil))
|
# Note that `nfIsRef` + `nkNilLit` represents an allocated
|
||||||
|
# reference with the value `nil`, so `isNil` should be false!
|
||||||
|
(node.kind == nkNilLit and nfIsRef notin node.flags) or
|
||||||
|
(node.kind in {nkStrLit..nkTripleStrLit} and node.strVal.isNil) or
|
||||||
|
(not node.typ.isNil and node.typ.kind == tyProc and
|
||||||
|
node.typ.callConv == ccClosure and node.sons[0].kind == nkNilLit and
|
||||||
|
node.sons[1].kind == nkNilLit))
|
||||||
of opcNBindSym:
|
of opcNBindSym:
|
||||||
decodeBx(rkNode)
|
decodeBx(rkNode)
|
||||||
regs[ra].node = copyTree(c.constants.sons[rbx])
|
regs[ra].node = copyTree(c.constants.sons[rbx])
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,21 @@ block:
|
||||||
result = size
|
result = size
|
||||||
doAssert f(4) == 4
|
doAssert f(4) == 4
|
||||||
|
|
||||||
|
# #6689
|
||||||
|
block:
|
||||||
|
static:
|
||||||
|
proc foo(): int = 0
|
||||||
|
var f: proc(): int
|
||||||
|
doAssert f.isNil
|
||||||
|
f = foo
|
||||||
|
doAssert(not f.isNil)
|
||||||
|
|
||||||
|
block:
|
||||||
|
static:
|
||||||
|
var x: ref ref int
|
||||||
|
new(x)
|
||||||
|
doAssert(not x.isNil)
|
||||||
|
|
||||||
# #7871
|
# #7871
|
||||||
static:
|
static:
|
||||||
type Obj = object
|
type Obj = object
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue