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.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 =
|
||||
result = c.constants.len
|
||||
c.constants.add n
|
||||
c.constants.add n.nilLiteral
|
||||
internalAssert result < 0x7fff
|
||||
|
||||
proc sameConstant*(a, b: PNode): bool =
|
||||
|
|
@ -1109,7 +1118,12 @@ proc getNullValue(typ: PType, info: TLineInfo): PNode =
|
|||
result = newNodeIT(nkFloatLit, info, t)
|
||||
of tyVar, tyPointer, tyPtr, tyCString, tySequence, tyString, tyExpr,
|
||||
tyStmt, tyTypeDesc, tyStatic, tyRef:
|
||||
result = newNodeIT(nkNilLit, info, t)
|
||||
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)
|
||||
of tyProc:
|
||||
if t.callConv != ccClosure:
|
||||
result = newNodeIT(nkNilLit, info, t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue