summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-06-20 19:40:18 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-06-20 19:40:18 +0200
commitf310cf52502fbf7ac27600a06f26fd00d06e0e3a (patch)
tree78ec6170bfdb5e3806f359a204ce97b0cbf7caf1 /lib/core
parent280193cc078c8777c6f4465eb141a441ed9d0638 (diff)
downloadNim-f310cf52502fbf7ac27600a06f26fd00d06e0e3a.tar.gz
[other] added system.dispose for owned refs
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/runtime_v2.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/core/runtime_v2.nim b/lib/core/runtime_v2.nim
index 5689e3072..4bc271f49 100644
--- a/lib/core/runtime_v2.nim
+++ b/lib/core/runtime_v2.nim
@@ -75,6 +75,9 @@ proc nimRawDispose(p: pointer) {.compilerRtl.} =
       cstderr.rawWrite "[FATAL] unpaired dealloc\n"
       quit 1
 
+template dispose*[T](x: owned(ref T)) = nimRawDispose(cast[pointer](x))
+#proc dispose*(x: pointer) = nimRawDispose(x)
+
 proc nimDestroyAndDispose(p: pointer) {.compilerRtl.} =
   let d = cast[ptr PNimType](p)[].destructor
   if d != nil: cast[DestructorProc](d)(p)