summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-03-10 15:37:42 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-03-10 15:37:42 +0100
commit1073f9ec5a122b9cb66bac1dfe341583e804af89 (patch)
tree2619c2a6057908d71b92a02b6d6a98d1f266da4b
parenta1a44c99de2a1e9302832e33815360acf3dbae18 (diff)
parentd9101ea5eb6498f009f2fa35a3dda0102a48d912 (diff)
downloadNim-1073f9ec5a122b9cb66bac1dfe341583e804af89.tar.gz
Merge pull request #3957 from endragor/vmropes
Make ropes usable in VM context
-rw-r--r--lib/pure/ropes.nim13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/pure/ropes.nim b/lib/pure/ropes.nim
index df7071642..6e97237e0 100644
--- a/lib/pure/ropes.nim
+++ b/lib/pure/ropes.nim
@@ -134,11 +134,16 @@ proc rope*(s: string): Rope {.rtl, extern: "nro$1Str".} =
   ## Converts a string to a rope.
   if s.len == 0:
     result = nil
-  elif cacheEnabled:
-    result = insertInCache(s, cache)
-    cache = result
   else:
-    result = newRope(s)
+    when nimvm:
+      # No caching in VM context
+      result = newRope(s)
+    else:
+      if cacheEnabled:
+        result = insertInCache(s, cache)
+        cache = result
+      else:
+        result = newRope(s)
 
 proc rope*(i: BiggestInt): Rope {.rtl, extern: "nro$1BiggestInt".} =
   ## Converts an int to a rope.