mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
Fixes #2749, traverse full inheritance for reprRecord
This commit is contained in:
@@ -193,11 +193,17 @@ when not defined(useNimRtl):
|
||||
proc reprRecord(result: var string, p: pointer, typ: PNimType,
|
||||
cl: var TReprClosure) =
|
||||
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 lastPart = ""
|
||||
while curTyp.base != nil:
|
||||
var part = ""
|
||||
reprRecordAux(part, p, curTyp.node, cl)
|
||||
if part.len > 0:
|
||||
if lastPart.len > 0:
|
||||
add result, ",\n"
|
||||
add result, part
|
||||
lastPart = part
|
||||
curTyp = curTyp.base
|
||||
add result, "]"
|
||||
|
||||
proc reprRef(result: var string, p: pointer, typ: PNimType,
|
||||
|
||||
Reference in New Issue
Block a user