further steps in implementing sink parameters; refs #7041

This commit is contained in:
Araq 2018-03-30 02:32:13 +02:00
commit 9de05ec3e0
10 changed files with 177 additions and 20 deletions

View file

@ -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,

View file

@ -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")