lib/core: Made more attributes fun since they are not used frequently
[nit.git] / lib / core / text / flat.nit
index a6f955a..53c6e7a 100644 (file)
@@ -420,9 +420,9 @@ abstract class FlatString
        # Index at which `self` begins in `_items`, inclusively
        redef var first_byte is noinit
 
-       redef var chars = new FlatStringCharView(self) is lazy
+       redef fun chars do return new FlatStringCharView(self)
 
-       redef var bytes = new FlatStringByteView(self) is lazy
+       redef fun bytes do return new FlatStringByteView(self)
 
        redef fun to_cstring do
                var blen = _byte_length
@@ -874,13 +874,9 @@ class FlatBuffer
        super FlatText
        super Buffer
 
-       redef var chars: Sequence[Char] = new FlatBufferCharView(self) is lazy
+       redef fun chars do return new FlatBufferCharView(self)
 
-       redef var bytes = new FlatBufferByteView(self) is lazy
-
-       private var char_cache: Int = -1
-
-       private var byte_cache: Int = -1
+       redef fun bytes do return new FlatBufferByteView(self)
 
        private var capacity = 0
 
@@ -926,7 +922,6 @@ class FlatBuffer
        do
                assert index >= 0 and index <= _length
                if written then reset
-               is_dirty = true
                if index == _length then
                        add item
                        return
@@ -949,7 +944,6 @@ class FlatBuffer
        redef fun add(c)
        do
                if written then reset
-               is_dirty = true
                var clen = c.u8char_len
                var bt = _byte_length
                enlarge(bt + clen)
@@ -959,7 +953,6 @@ class FlatBuffer
        end
 
        redef fun clear do
-               is_dirty = true
                _byte_length = 0
                _length = 0
                if written then
@@ -1046,7 +1039,6 @@ class FlatBuffer
        redef fun append(s)
        do
                if s.is_empty then return
-               is_dirty = true
                var sl = s.byte_length
                var nln = _byte_length + sl
                enlarge(nln)