fixes #1456
This commit is contained in:
parent
68accb53c4
commit
32197b7a13
1 changed files with 18 additions and 11 deletions
|
|
@ -93,6 +93,8 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType) =
|
||||||
if s2 == nil:
|
if s2 == nil:
|
||||||
unsureAsgnRef(cast[PPointer](dest), s2)
|
unsureAsgnRef(cast[PPointer](dest), s2)
|
||||||
return
|
return
|
||||||
|
when defined(usrToCell):
|
||||||
|
# unfortunately we only have cycle detection for our native GCs.
|
||||||
let x = usrToCell(s2)
|
let x = usrToCell(s2)
|
||||||
let forw = cast[int](x.typ)
|
let forw = cast[int](x.typ)
|
||||||
if (forw and 1) == 1:
|
if (forw and 1) == 1:
|
||||||
|
|
@ -107,6 +109,11 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType) =
|
||||||
x.typ = cast[PNimType](cast[int](z) or 1)
|
x.typ = cast[PNimType](cast[int](z) or 1)
|
||||||
genericDeepCopyAux(z, s2, realType.base)
|
genericDeepCopyAux(z, s2, realType.base)
|
||||||
x.typ = realType
|
x.typ = realType
|
||||||
|
else:
|
||||||
|
let realType = x.typ
|
||||||
|
let z = newObj(realType, realType.base.size)
|
||||||
|
unsureAsgnRef(cast[PPointer](dest), z)
|
||||||
|
genericDeepCopyAux(z, s2, realType.base)
|
||||||
of tyPtr:
|
of tyPtr:
|
||||||
# no cycle check here, but also not really required
|
# no cycle check here, but also not really required
|
||||||
if mt.base.deepCopy != nil:
|
if mt.base.deepCopy != nil:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue