Skip to content

Commit

Permalink
Update common.nim
Browse files Browse the repository at this point in the history
add check for arc/orc in crossVersionDestructor() to allow compiling with other GCs.
  • Loading branch information
ITwrx authored Nov 22, 2024
1 parent 405e22b commit 0788f0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions owlkettle/common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ template customPragmas*() =
{.pragma: locker, locks: 0.}

template crossVersionDestructor*(name: untyped, typ: typedesc, body: untyped) =
const arcLike = defined(gcArc) or defined(gcAtomicArc) or defined(gcOrc)
## Defines a =destroy to work for both nim 2 and nim 1.6.X
when NimMajor >= 2:
when NimMajor >= 2 and arcLike:
proc `=destroy`*(name: typ) =
body
else:
proc `=destroy`*(name: var typ) =
body
body

0 comments on commit 0788f0c

Please sign in to comment.