mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-29 01:51:43 +00:00
fixes assertion defect when encoding empty object type definition
This commit is contained in:
@@ -99,6 +99,7 @@ proc toNifDef(c: var EncodeContext; typ: PType) =
|
||||
c.dest.buildTree sonsTag:
|
||||
for ch in typ.kids:
|
||||
c.toNif ch
|
||||
|
||||
c.toNif typ.n
|
||||
c.toNif typ.owner
|
||||
c.toNif typ.sym
|
||||
@@ -188,7 +189,7 @@ proc toNif(c: var EncodeContext; n: PNode) =
|
||||
c.withNode n:
|
||||
discard
|
||||
else:
|
||||
assert n.kind in {nkArgList, nkBracket} or n.len > 0, $n.kind
|
||||
assert n.kind in {nkArgList, nkBracket, nkRecList} or n.len > 0, $n.kind
|
||||
c.withNode(n):
|
||||
for i in 0 ..< n.len:
|
||||
c.toNif n[i]
|
||||
|
||||
@@ -21,6 +21,8 @@ type
|
||||
TestPtrObj = ptr object
|
||||
x: int
|
||||
|
||||
TestEmptyObj = object
|
||||
|
||||
var x: TestInt
|
||||
var testEnum: TestEnum
|
||||
var testEnum1 = X
|
||||
@@ -34,3 +36,4 @@ var testPtrInt: TestPtrInt = nil
|
||||
var testPtrInt2: ptr int = nil
|
||||
var testRefObj: TestRefObj = nil
|
||||
var testPtrObj: TestPtrObj = nil
|
||||
var testEmptyObj: TestEmptyObj
|
||||
|
||||
Reference in New Issue
Block a user