summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorRuslan Mustakov <ruslan.mustakov@xored.com>2016-03-09 20:36:35 +0600
committerRuslan Mustakov <ruslan.mustakov@xored.com>2016-03-10 19:13:40 +0600
commitd9101ea5eb6498f009f2fa35a3dda0102a48d912 (patch)
tree5837b0206fe7fc5d490dedc1efef41a72cbd3357 /lib
parent7281b66a4f91ec7f8124353835c627362dac23c1 (diff)
downloadNim-d9101ea5eb6498f009f2fa35a3dda0102a48d912.tar.gz
Make ropes usable in VM context
Diffstat (limited to 'lib')
-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.