summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2022-07-10 15:37:15 +0800
committerGitHub <noreply@github.com>2022-07-10 09:37:15 +0200
commited2bf02a511ae230243ce384ad16c318ca3fe661 (patch)
tree0cfc4afa717460413d3a1c18d0c2fd0c65ffcda6 /compiler
parente8ee2f9c2ad06cad2f62fe7505acbb43530f28d7 (diff)
downloadNim-ed2bf02a511ae230243ce384ad16c318ca3fe661.tar.gz
remove `when declared(cache)`; cache is always there (#19991)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ropes.nim15
1 files changed, 6 insertions, 9 deletions
diff --git a/compiler/ropes.nim b/compiler/ropes.nim
index 610159c75..677a3ce09 100644
--- a/compiler/ropes.nim
+++ b/compiler/ropes.nim
@@ -111,16 +111,13 @@ var gCacheMisses* = 0
 var gCacheIntTries* = 0
 
 proc insertInCache(s: string): Rope =
-  when declared(cache):
-    inc gCacheTries
-    var h = hash(s) and high(cache)
-    result = cache[h]
-    if isNil(result) or result.data != s:
-      inc gCacheMisses
-      result = newRope(s)
-      cache[h] = result
-  else:
+  inc gCacheTries
+  var h = hash(s) and high(cache)
+  result = cache[h]
+  if isNil(result) or result.data != s:
+    inc gCacheMisses
     result = newRope(s)
+    cache[h] = result
 
 proc rope*(s: string): Rope =
   ## Converts a string to a rope.