diff options
author | Araq <rumpf_a@web.de> | 2014-12-14 11:49:32 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-12-14 11:49:32 +0100 |
commit | bebac34f878a87419c5d0e24a18edb50ebad5f0a (patch) | |
tree | e871d2e512857bd7be494aa367aca26176cd4c2c /lib | |
parent | 556f4880874b09bccea99bbb3b7aa46159977fef (diff) | |
download | Nim-bebac34f878a87419c5d0e24a18edb50ebad5f0a.tar.gz |
fixes #1352
Diffstat (limited to 'lib')
-rw-r--r-- | lib/core/typeinfo.nim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim index 1b9b95c24..0046924a1 100644 --- a/lib/core/typeinfo.nim +++ b/lib/core/typeinfo.nim @@ -269,9 +269,14 @@ iterator fields*(x: TAny): tuple[name: string, any: TAny] = # XXX BUG: does not work yet, however is questionable anyway when false: if x.rawType.kind == tyObject: t = cast[ptr PNimType](x.value)[] - var n = t.node var ret: seq[tuple[name: cstring, any: TAny]] = @[] - fieldsAux(p, n, ret) + if t.kind == tyObject: + while true: + fieldsAux(p, t.node, ret) + t = t.base + if t.isNil: break + else: + fieldsAux(p, t.node, ret) for name, any in items(ret): yield ($name, any) |