From: Lucas Bajolet Date: Thu, 5 May 2016 15:05:42 +0000 (-0400) Subject: lib/core: Fix `new FlatBuffer.from` X-Git-Url: http://nitlanguage.org lib/core: Fix `new FlatBuffer.from` Signed-off-by: Lucas Bajolet --- diff --git a/lib/core/text/flat.nit b/lib/core/text/flat.nit index 45ad144..9f5659a 100644 --- a/lib/core/text/flat.nit +++ b/lib/core/text/flat.nit @@ -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.