Merge pull request #2768 from gokr/fix-repr
Fixes #2749, traverse full inheritance for reprRecord
This commit is contained in:
commit
e2bcf22a84
1 changed files with 11 additions and 5 deletions
|
|
@ -194,11 +194,17 @@ when not defined(useNimRtl):
|
||||||
proc reprRecord(result: var string, p: pointer, typ: PNimType,
|
proc reprRecord(result: var string, p: pointer, typ: PNimType,
|
||||||
cl: var ReprClosure) =
|
cl: var ReprClosure) =
|
||||||
add result, "["
|
add result, "["
|
||||||
let oldLen = result.len
|
var curTyp = typ
|
||||||
reprRecordAux(result, p, typ.node, cl)
|
var first = true
|
||||||
if typ.base != nil:
|
while curTyp.base != nil:
|
||||||
if oldLen != result.len: add result, ",\n"
|
var part = ""
|
||||||
reprRecordAux(result, p, typ.base.node, cl)
|
reprRecordAux(part, p, curTyp.node, cl)
|
||||||
|
if part.len > 0:
|
||||||
|
if not first:
|
||||||
|
add result, ",\n"
|
||||||
|
add result, part
|
||||||
|
first = false
|
||||||
|
curTyp = curTyp.base
|
||||||
add result, "]"
|
add result, "]"
|
||||||
|
|
||||||
proc reprRef(result: var string, p: pointer, typ: PNimType,
|
proc reprRef(result: var string, p: pointer, typ: PNimType,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue