lib/standard: More uses of new FlatString.full when appropriate
authorLucas Bajolet <r4pass@hotmail.com>
Wed, 26 Aug 2015 20:42:28 +0000 (16:42 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Fri, 28 Aug 2015 19:21:04 +0000 (15:21 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/core/text/flat.nit
lib/core/text/ropes.nit

index 917b0e5..bebc8e5 100644 (file)
@@ -589,7 +589,7 @@ class FlatBuffer
        do
                written = true
                if bytelen == 0 then items = new NativeString(1)
-               return new FlatString.with_infos(items, bytelen, 0, bytelen - 1)
+               return new FlatString.full(items, bytelen, 0, bytelen - 1, length)
        end
 
        redef fun to_cstring
@@ -700,7 +700,7 @@ class FlatBuffer
 
        redef fun times(repeats)
        do
-               var x = new FlatString.with_infos(items, bytelen, 0, bytelen - 1)
+               var x = new FlatString.full(items, bytelen, 0, bytelen - 1, length)
                for i in [1 .. repeats[ do
                        append(x)
                end
index 2b3ff28..f582292 100644 (file)
@@ -559,7 +559,7 @@ redef class FlatString
                        var ns = new NativeString(nlen + 1)
                        mits.copy_to(ns, mlen, mifrom, 0)
                        sits.copy_to(ns, slen, sifrom, mlen)
-                       return ns.to_s_with_length(nlen)
+                       return new FlatString.full(ns, nlen, 0, nlen - 1, length + s.length)
                else if s isa Concat then
                        var sl = s.left
                        var sllen = sl.bytelen