summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-04-12 13:28:00 +0200
committerAraq <rumpf_a@web.de>2019-04-12 13:28:13 +0200
commit8201db81b2ac3c5dea85b5f8707d1d802dba53ba (patch)
treed225470a4b05f0bb76d21db091b6c4215e390459
parent3ceb258ebf684bff9019e1fb5848c5c3f327b0fc (diff)
downloadNim-8201db81b2ac3c5dea85b5f8707d1d802dba53ba.tar.gz
added system.disarm (experimental)
-rw-r--r--lib/system.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 179dc175a..a04433530 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1657,6 +1657,13 @@ else:
     new(r)
     return r
 
+template disarm*(x: typed) =
+  ## Useful for ``disarming`` dangling pointers explicitly for the
+  ## --newruntime. Regardless of whether --newruntime is used or not
+  ## this sets the pointer or callback ``x`` to ``nil``. This is an
+  ## experimental API!
+  x = nil
+
 proc `of`*[T, S](x: typeDesc[T], y: typeDesc[S]): bool {.magic: "Of", noSideEffect.}
 proc `of`*[T, S](x: T, y: typeDesc[S]): bool {.magic: "Of", noSideEffect.}
 proc `of`*[T, S](x: T, y: S): bool {.magic: "Of", noSideEffect.}