From: Lucas Bajolet Date: Mon, 9 Jun 2014 15:58:44 +0000 (-0400) Subject: lib/standard/ropes: Adapted write for performance with other String representations. X-Git-Tag: v0.6.6~43^2~7 X-Git-Url: http://nitlanguage.org lib/standard/ropes: Adapted write for performance with other String representations. Signed-off-by: Lucas Bajolet --- diff --git a/lib/standard/file.nit b/lib/standard/file.nit index 27b2626..f82a1fd 100644 --- a/lib/standard/file.nit +++ b/lib/standard/file.nit @@ -16,7 +16,7 @@ module file intrude import stream -intrude import string +intrude import ropes import string_search import time @@ -134,7 +134,11 @@ class OFStream redef fun write(s) do assert _writable - write_native(s.to_cstring, s.length) + if s isa FlatText then + write_native(s.to_cstring, s.length) + else + for i in s.substrings do write_native(i.to_cstring, i.length) + end end redef fun is_writable do return _writable