summary refs log tree commit diff stats
path: root/lib/pure/collections/tables.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-11-04 16:25:40 +0800
committerGitHub <noreply@github.com>2022-11-04 16:25:40 +0800
commit8fb172c7a62732306ada098a276fada77f8f4805 (patch)
tree7c28cf98e7fdcbc9b9dd2fdb4d5b8e0f533a6b78 /lib/pure/collections/tables.nim
parent090661d46cefdb62ff376fd2ce316c5a052752f3 (diff)
downloadNim-8fb172c7a62732306ada098a276fada77f8f4805.tar.gz
add `effectsOf` to `std/tables` (#20751)
Diffstat (limited to 'lib/pure/collections/tables.nim')
-rw-r--r--lib/pure/collections/tables.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index 5c62ed56a..cd08dcb9a 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -199,6 +199,10 @@ runnableExamples:
 import std/private/since
 import hashes, math, algorithm
 
+
+when not defined(nimHasEffectsOf):
+  {.pragma: effectsOf.}
+
 type
   KeyValuePair[A, B] = tuple[hcode: Hash, key: A, val: B]
   KeyValuePairSeq[A, B] = seq[KeyValuePair[A, B]]
@@ -1597,7 +1601,7 @@ proc clear*[A, B](t: var OrderedTable[A, B]) =
   t.last = -1
 
 proc sort*[A, B](t: var OrderedTable[A, B], cmp: proc (x, y: (A, B)): int,
-    order = SortOrder.Ascending) =
+    order = SortOrder.Ascending) {.effectsOf: cmp.} =
   ## Sorts `t` according to the function `cmp`.
   ##
   ## This modifies the internal list
@@ -2054,7 +2058,7 @@ proc clear*[A, B](t: OrderedTableRef[A, B]) =
   clear(t[])
 
 proc sort*[A, B](t: OrderedTableRef[A, B], cmp: proc (x, y: (A, B)): int,
-    order = SortOrder.Ascending) =
+    order = SortOrder.Ascending) {.effectsOf: cmp.} =
   ## Sorts `t` according to the function `cmp`.
   ##
   ## This modifies the internal list