summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-03-30 02:32:13 +0200
committerAraq <rumpf_a@web.de>2018-03-30 02:32:13 +0200
commit9de05ec3e04e8a2321b29896fe9fa7db4c6e65f3 (patch)
tree8667e2a5c64d93b29b748feaf29066d64fa925d1 /lib
parent1d9343080de8e19835c3f6568630ba759afbb94f (diff)
downloadNim-9de05ec3e04e8a2321b29896fe9fa7db4c6e65f3.tar.gz
further steps in implementing sink parameters; refs #7041
Diffstat (limited to 'lib')
-rw-r--r--lib/system.nim5
-rw-r--r--lib/system/chcks.nim5
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 7116f8818..7eda30276 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -617,6 +617,11 @@ type
     ##
     ## This is only raised if the ``segfaults.nim`` module was imported!
 
+when defined(nimNewRuntime):
+  type
+    MoveError* = object of SystemError ## \
+      ## Raised on attempts to re-sink an already consumed ``sink`` parameter.
+
 {.deprecated: [TObject: RootObj, PObject: RootRef, TEffect: RootEffect,
   FTime: TimeEffect, FIO: IOEffect, FReadIO: ReadIOEffect,
   FWriteIO: WriteIOEffect, FExecIO: ExecIOEffect,
diff --git a/lib/system/chcks.nim b/lib/system/chcks.nim
index 69b680dbd..d3651f659 100644
--- a/lib/system/chcks.nim
+++ b/lib/system/chcks.nim
@@ -52,6 +52,11 @@ proc chckNil(p: pointer) =
   if p == nil:
     sysFatal(NilAccessError, "attempt to write to a nil address")
 
+when defined(nimNewRuntime):
+  proc chckMove(b: bool) {.compilerproc.} =
+    if not b:
+      sysFatal(MoveError, "attempt to access an object that was moved")
+
 proc chckNilDisp(p: pointer) {.compilerproc.} =
   if p == nil:
     sysFatal(NilAccessError, "cannot dispatch; dispatcher is nil")