Make ropes usable in VM context
This commit is contained in:
parent
7281b66a4f
commit
d9101ea5eb
1 changed files with 9 additions and 4 deletions
|
|
@ -134,11 +134,16 @@ proc rope*(s: string): Rope {.rtl, extern: "nro$1Str".} =
|
||||||
## Converts a string to a rope.
|
## Converts a string to a rope.
|
||||||
if s.len == 0:
|
if s.len == 0:
|
||||||
result = nil
|
result = nil
|
||||||
elif cacheEnabled:
|
|
||||||
result = insertInCache(s, cache)
|
|
||||||
cache = result
|
|
||||||
else:
|
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".} =
|
proc rope*(i: BiggestInt): Rope {.rtl, extern: "nro$1BiggestInt".} =
|
||||||
## Converts an int to a rope.
|
## Converts an int to a rope.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue