lib/core: Fix `new FlatBuffer.from`
authorLucas Bajolet <r4pass@hotmail.com>
Thu, 5 May 2016 15:05:42 +0000 (11:05 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Thu, 5 May 2016 17:47:17 +0000 (13:47 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/core/text/flat.nit

index 45ad144..9f5659a 100644 (file)
@@ -991,15 +991,10 @@ class FlatBuffer
        init from(s: Text)
        do
                _items = new NativeString(s.bytelen)
-               if s isa FlatText then
-                       _items = s._items
-               else
-                       for i in substrings do i.as(FlatString)._items.copy_to(_items, i._bytelen, 0, 0)
-               end
+               for i in s.substrings do i._items.copy_to(_items, i._bytelen, first_byte, 0)
                _bytelen = s.bytelen
                _length = s.length
                _capacity = _bytelen
-               written = true
        end
 
        # Create a new empty string with a given capacity.