first steps of making 'opt' a first class type for Nim

This commit is contained in:
Andreas Rumpf 2017-09-25 13:19:36 +02:00
commit f7f3a25be8
20 changed files with 198 additions and 35 deletions

View file

@ -124,7 +124,7 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType; tab: var PtrTable) =
for i in 0..(mt.size div mt.base.size)-1:
genericDeepCopyAux(cast[pointer](d +% i*% mt.base.size),
cast[pointer](s +% i*% mt.base.size), mt.base, tab)
of tyRef:
of tyRef, tyOptAsRef:
let s2 = cast[PPointer](src)[]
if s2 == nil:
unsureAsgnRef(cast[PPointer](dest), s2)