Merge pull request #2768 from gokr/fix-repr

Fixes #2749, traverse full inheritance for reprRecord
This commit is contained in:
Andreas Rumpf
2015-06-16 20:48:51 +02:00

View File

@@ -194,11 +194,17 @@ when not defined(useNimRtl):
proc reprRecord(result: var string, p: pointer, typ: PNimType,
cl: var ReprClosure) =
add result, "["
let oldLen = result.len
reprRecordAux(result, p, typ.node, cl)
if typ.base != nil:
if oldLen != result.len: add result, ",\n"
reprRecordAux(result, p, typ.base.node, cl)
var curTyp = typ
var first = true
while curTyp.base != nil:
var part = ""
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, "]"
proc reprRef(result: var string, p: pointer, typ: PNimType,