Make ropes usable in VM context

This commit is contained in:
Ruslan Mustakov
2016-03-09 20:36:35 +06:00
parent 7281b66a4f
commit d9101ea5eb

View File

@@ -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.