Move codePointAt() to separate CodePointSequence class.

This commit is contained in:
Bob Nystrom
2015-09-11 07:56:01 -07:00
parent bda9ad880a
commit c0b5ec9f15
30 changed files with 202 additions and 76 deletions
+13
View File
@@ -130,6 +130,7 @@ class WhereSequence is Sequence {
class String is Sequence {
bytes { StringByteSequence.new(this) }
codePoints { StringCodePointSequence.new(this) }
}
class StringByteSequence is Sequence {
@@ -144,6 +145,18 @@ class StringByteSequence is Sequence {
count { _string.byteCount_ }
}
class StringCodePointSequence is Sequence {
construct new(string) {
_string = string
}
[index] { _string.codePointAt_(index) }
iterate(iterator) { _string.iterate(iterator) }
iteratorValue(iterator) { _string.codePointAt_(iterator) }
count { _string.count }
}
class List is Sequence {
addAll(other) {
for (element in other) {