summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-06-11 16:49:56 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-06-11 16:49:56 +0200
commitc7e1c665a1d399272bef35395a6c364b9f98d64a (patch)
tree36e3be6be3f0e362ac0ccd09d57669ddb022d3f5 /lib
parent3d13103443f0fb4630e648ad7eabd2b40f0be52b (diff)
downloadNim-c7e1c665a1d399272bef35395a6c364b9f98d64a.tar.gz
[refactoring] refactor the compiler and stdlib to deprecation warnings (#11419)
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/collections/sets.nim4
-rw-r--r--lib/system.nim16
-rw-r--r--lib/system/repr.nim4
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim
index 14f7dad94..c4991ed3d 100644
--- a/lib/pure/collections/sets.nim
+++ b/lib/pure/collections/sets.nim
@@ -61,7 +61,7 @@ when not defined(nimhygiene):
 type
   KeyValuePair[A] = tuple[hcode: Hash, key: A]
   KeyValuePairSeq[A] = seq[KeyValuePair[A]]
-  HashSet* {.myShallow.} [A] = object ## \
+  HashSet*[A] {.myShallow.} = object ## \
     ## A generic hash set.
     ##
     ## Use `init proc <#init,HashSet[A],int>`_ or `initHashSet proc <#initHashSet,int>`_
@@ -73,7 +73,7 @@ type
   OrderedKeyValuePair[A] = tuple[
     hcode: Hash, next: int, key: A]
   OrderedKeyValuePairSeq[A] = seq[OrderedKeyValuePair[A]]
-  OrderedSet* {.myShallow.} [A] = object ## \
+  OrderedSet*[A] {.myShallow.} = object ## \
     ## A generic hash set that remembers insertion order.
     ##
     ## Use `init proc <#init,OrderedSet[A],int>`_ or `initOrderedSet proc
diff --git a/lib/system.nim b/lib/system.nim
index d22585c6a..65f04a4ca 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -3646,21 +3646,21 @@ when not defined(JS): #and not defined(nimscript):
       const GenericSeqSize = (2 * sizeof(int))
 
     when not defined(nimV2):
-      proc getDiscriminant(aa: pointer, n: ptr TNimNode): int =
+      proc getDiscriminant(aa: pointer, n: ptr TNimNode): uint =
         sysAssert(n.kind == nkCase, "getDiscriminant: node != nkCase")
-        var d: int
-        var a = cast[ByteAddress](aa)
+        var d: uint
+        var a = cast[uint](aa)
         case n.typ.size
-        of 1: d = ze(cast[ptr int8](a +% n.offset)[])
-        of 2: d = ze(cast[ptr int16](a +% n.offset)[])
-        of 4: d = int(cast[ptr int32](a +% n.offset)[])
-        of 8: d = int(cast[ptr int64](a +% n.offset)[])
+        of 1: d = uint(cast[ptr uint8](a + uint(n.offset))[])
+        of 2: d = uint(cast[ptr uint16](a + uint(n.offset))[])
+        of 4: d = uint(cast[ptr uint32](a + uint(n.offset))[])
+        of 8: d = uint(cast[ptr uint64](a + uint(n.offset))[])
         else: sysAssert(false, "getDiscriminant: invalid n.typ.size")
         return d
 
       proc selectBranch(aa: pointer, n: ptr TNimNode): ptr TNimNode =
         var discr = getDiscriminant(aa, n)
-        if discr <% n.len:
+        if discr < cast[uint](n.len):
           result = n.sons[discr]
           if result == nil: result = n.sons[n.len]
           # n.sons[n.len] contains the ``else`` part (but may be nil)
diff --git a/lib/system/repr.nim b/lib/system/repr.nim
index 67e625a8e..f276853cd 100644
--- a/lib/system/repr.nim
+++ b/lib/system/repr.nim
@@ -78,7 +78,7 @@ proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} =
   result = $e & " (invalid data!)"
 
 type
-  PByteArray = ptr array[0xffff, int8]
+  PByteArray = ptr array[0xffff, byte]
 
 proc addSetElem(result: var string, elem: int, typ: PNimType) {.benign.} =
   case typ.kind
@@ -104,7 +104,7 @@ proc reprSetAux(result: var string, p: pointer, typ: PNimType) =
   else:
     var a = cast[PByteArray](p)
     for i in 0 .. typ.size*8-1:
-      if (ze(a[i div 8]) and (1 shl (i mod 8))) != 0:
+      if (uint(a[i shr 3]) and (1'u shl (i and 7))) != 0:
         if elemCounter > 0: add result, ", "
         addSetElem(result, i+typ.node.len, typ.base)
         inc(elemCounter)