system.deepCopy should show old behaviour
This commit is contained in:
parent
7ca72a733c
commit
734443d725
1 changed files with 6 additions and 1 deletions
|
|
@ -134,7 +134,7 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType; tab: var PtrTable) =
|
|||
else:
|
||||
let z = tab.get(s2)
|
||||
if z == nil:
|
||||
when declared(usrToCell) and false:
|
||||
when declared(usrToCell):
|
||||
let x = usrToCell(s2)
|
||||
let realType = x.typ
|
||||
let z = newObj(realType, realType.base.size)
|
||||
|
|
@ -142,6 +142,11 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType; tab: var PtrTable) =
|
|||
tab.put(s2, z)
|
||||
genericDeepCopyAux(z, s2, realType.base, tab)
|
||||
else:
|
||||
when false:
|
||||
# addition check disabled
|
||||
let x = usrToCell(s2)
|
||||
let realType = x.typ
|
||||
sysAssert realType == mt, " types do differ"
|
||||
# this version should work for any possible GC:
|
||||
let size = if mt.base.kind == tyObject: cast[ptr PNimType](s2)[].size else: mt.base.size
|
||||
let z = newObj(mt, size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue