nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
benches/strings: add .gitignore and `make clean`
[nit.git]
/
lib
/
standard
/
ropes.nit
diff --git
a/lib/standard/ropes.nit
b/lib/standard/ropes.nit
index
68593fd
..
644e3dc
100644
(file)
--- a/
lib/standard/ropes.nit
+++ b/
lib/standard/ropes.nit
@@
-67,20
+67,20
@@
private abstract class RopeString
super Rope
super String
super Rope
super String
- redef fun chars is cached do return new RopeChars(self)
+ redef var chars is lazy do return new RopeChars(self)
end
# Node that represents a concatenation between two `String`
private class Concat
super RopeString
end
# Node that represents a concatenation between two `String`
private class Concat
super RopeString
- redef var length: Int
+ redef var length: Int is noinit
redef fun substrings do return new RopeSubstrings(self)
redef fun empty do return ""
redef fun substrings do return new RopeSubstrings(self)
redef fun empty do return ""
- redef fun to_cstring is cached do
+ redef var to_cstring is lazy do
var len = length
var ns = new NativeString(len + 1)
ns[len] = '\0'
var len = length
var ns = new NativeString(len + 1)
ns[len] = '\0'
@@
-98,10
+98,8
@@
private class Concat
# Right child of the node
var right: String
# Right child of the node
var right: String
- init(l: String, r: String) is old_style_init do
- left = l
- right = r
- length = l.length + r.length
+ init do
+ length = left.length + right.length
end
redef fun output do
end
redef fun output do
@@
-179,7
+177,7
@@
class RopeBuffer
super Rope
super Buffer
super Rope
super Buffer
- redef fun chars: Sequence[Char] is cached do return new RopeBufferChars(self)
+ redef var chars: Sequence[Char] is lazy do return new RopeBufferChars(self)
# The final string being built on the fly
private var str: String is noinit
# The final string being built on the fly
private var str: String is noinit
@@
-780,17
+778,15
@@
end
private class RopeChars
super StringCharView
private class RopeChars
super StringCharView
- var tgt: RopeString
-
- init(s: RopeString) is old_style_init do tgt = s
+ redef type SELFTYPE: RopeString
redef fun [](i) do
redef fun [](i) do
- return tgt[i]
+ return target[i]
end
end
- redef fun iterator_from(i) do return new RopeIter.from(tgt, i)
+ redef fun iterator_from(i) do return new RopeIter.from(target, i)
- redef fun reverse_iterator_from(i) do return new RopeReviter.from(tgt, i)
+ redef fun reverse_iterator_from(i) do return new RopeReviter.from(target, i)
end
end