fixes #922
This commit is contained in:
parent
228d5173ff
commit
3ef92a34ee
1 changed files with 16 additions and 2 deletions
|
|
@ -321,9 +321,18 @@ proc genAndOr(c: PCtx; n: PNode; opc: TOpcode; dest: var TDest) =
|
||||||
c.gen(n.sons[2], dest)
|
c.gen(n.sons[2], dest)
|
||||||
c.patch(L1)
|
c.patch(L1)
|
||||||
|
|
||||||
|
proc nilLiteral(n: PNode): PNode =
|
||||||
|
if n.kind == nkNilLit and n.typ.sym != nil and
|
||||||
|
n.typ.sym.magic == mPNimrodNode:
|
||||||
|
let nilo = newNodeIT(nkNilLit, n.info, n.typ)
|
||||||
|
result = newNodeIT(nkMetaNode, n.info, n.typ)
|
||||||
|
result.add nilo
|
||||||
|
else:
|
||||||
|
result = n
|
||||||
|
|
||||||
proc rawGenLiteral(c: PCtx; n: PNode): int =
|
proc rawGenLiteral(c: PCtx; n: PNode): int =
|
||||||
result = c.constants.len
|
result = c.constants.len
|
||||||
c.constants.add n
|
c.constants.add n.nilLiteral
|
||||||
internalAssert result < 0x7fff
|
internalAssert result < 0x7fff
|
||||||
|
|
||||||
proc sameConstant*(a, b: PNode): bool =
|
proc sameConstant*(a, b: PNode): bool =
|
||||||
|
|
@ -1109,6 +1118,11 @@ proc getNullValue(typ: PType, info: TLineInfo): PNode =
|
||||||
result = newNodeIT(nkFloatLit, info, t)
|
result = newNodeIT(nkFloatLit, info, t)
|
||||||
of tyVar, tyPointer, tyPtr, tyCString, tySequence, tyString, tyExpr,
|
of tyVar, tyPointer, tyPtr, tyCString, tySequence, tyString, tyExpr,
|
||||||
tyStmt, tyTypeDesc, tyStatic, tyRef:
|
tyStmt, tyTypeDesc, tyStatic, tyRef:
|
||||||
|
if t.sym != nil and t.sym.magic == mPNimrodNode:
|
||||||
|
let nilo = newNodeIT(nkNilLit, info, t)
|
||||||
|
result = newNodeIT(nkMetaNode, info, t)
|
||||||
|
result.add nilo
|
||||||
|
else:
|
||||||
result = newNodeIT(nkNilLit, info, t)
|
result = newNodeIT(nkNilLit, info, t)
|
||||||
of tyProc:
|
of tyProc:
|
||||||
if t.callConv != ccClosure:
|
if t.callConv != ccClosure:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue