summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-03-03 12:34:00 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-04 15:41:07 +0100
commit0fd5417aff619f00ceac4f976d9207ea4f3faf04 (patch)
tree88d30a53ec48d0bf3e4c95103a936c4dc3d73455 /lib/system.nim
parentdf3d08b58b172dae6fe1f2ecb72db288166d211d (diff)
downloadNim-0fd5417aff619f00ceac4f976d9207ea4f3faf04.tar.gz
code cleanup: there is no MoveError and sinks are always available
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim43
1 files changed, 16 insertions, 27 deletions
diff --git a/lib/system.nim b/lib/system.nim
index b1ac043be..a066e5e69 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -236,16 +236,15 @@ proc reset*[T](obj: var T) {.magic: "Reset", noSideEffect.}
   ## resets an object `obj` to its initial (binary zero) value. This needs to
   ## be called before any possible `object branch transition`:idx:.
 
-when defined(nimNewRuntime):
-  proc wasMoved*[T](obj: var T) {.magic: "WasMoved", noSideEffect.} =
-    ## resets an object `obj` to its initial (binary zero) value to signify
-    ## it was "moved" and to signify its destructor should do nothing and
-    ## ideally be optimized away.
-    discard
+proc wasMoved*[T](obj: var T) {.magic: "WasMoved", noSideEffect.} =
+  ## resets an object `obj` to its initial (binary zero) value to signify
+  ## it was "moved" and to signify its destructor should do nothing and
+  ## ideally be optimized away.
+  discard
 
-  proc move*[T](x: var T): T {.magic: "Move", noSideEffect.} =
-    result = x
-    wasMoved(x)
+proc move*[T](x: var T): T {.magic: "Move", noSideEffect.} =
+  result = x
+  wasMoved(x)
 
 type
   range*{.magic: "Range".}[T] ## Generic type to construct range types.
@@ -268,12 +267,8 @@ else:
     UncheckedArray*{.unchecked.}[T] = array[0,T]
     ## Array with no bounds checking
 
-when defined(nimHasOpt):
-  type opt*{.magic: "Opt".}[T]
-
-when defined(nimNewRuntime):
-  type sink*{.magic: "BuiltinType".}[T]
-  type lent*{.magic: "BuiltinType".}[T]
+type sink*{.magic: "BuiltinType".}[T]
+type lent*{.magic: "BuiltinType".}[T]
 
 proc high*[T: Ordinal](x: T): T {.magic: "High", noSideEffect.}
   ## returns the highest possible value of an ordinal value `x`. As a special
@@ -388,13 +383,12 @@ when defined(nimArrIdx):
   proc arrPut[I: Ordinal;T,S](a: T; i: I;
     x: S) {.noSideEffect, magic: "ArrPut".}
 
-  when defined(nimNewRuntime):
-    proc `=destroy`*[T](x: var T) {.inline, magic: "Destroy".} =
-      ## generic `destructor`:idx: implementation that can be overriden.
-      discard
-    proc `=sink`*[T](x: var T; y: T) {.inline, magic: "Asgn".} =
-      ## generic `sink`:idx: implementation that can be overriden.
-      shallowCopy(x, y)
+  proc `=destroy`*[T](x: var T) {.inline, magic: "Destroy".} =
+    ## generic `destructor`:idx: implementation that can be overriden.
+    discard
+  proc `=sink`*[T](x: var T; y: T) {.inline, magic: "Asgn".} =
+    ## generic `sink`:idx: implementation that can be overriden.
+    shallowCopy(x, y)
 
 type
   HSlice*[T, U] = object ## "heterogenous" slice type
@@ -676,11 +670,6 @@ type
     ##
     ## This is only raised if the ``segfaults.nim`` module was imported!
 
-when defined(nimNewRuntime):
-  type
-    MoveError* = object of Defect ## \
-      ## Raised on attempts to re-sink an already consumed ``sink`` parameter.
-
 when defined(js) or defined(nimdoc):
   type
     JsRoot* = ref object of RootObj