array code gen rewrite and work in progress on outer type info
This commit is contained in:
@@ -8,18 +8,22 @@ trait javaUtilIterator<T> : java.util.Iterator<T> {
|
||||
}
|
||||
}
|
||||
|
||||
class MyIterator<T>(val array : ReadOnlyArray<T>) : javaUtilIterator<T> {
|
||||
private var index = 0
|
||||
|
||||
override fun hasNext() : Boolean = index < array.size
|
||||
|
||||
override fun next() : T = array.get(index++)
|
||||
}
|
||||
|
||||
trait ReadOnlyArray<out T> : ISized, java.lang.Iterable<T> {
|
||||
fun get(index : Int) : T
|
||||
|
||||
class MyIterator() : javaUtilIterator<T> {
|
||||
private var index = 0
|
||||
|
||||
override fun hasNext() : Boolean = index < size
|
||||
|
||||
override fun next() : T = get(index++)
|
||||
class Default {
|
||||
fun check(v: Any) = v is T
|
||||
}
|
||||
|
||||
override fun iterator() : java.util.Iterator<T> = MyIterator()
|
||||
override fun iterator() : java.util.Iterator<T> = MyIterator<T>(this)
|
||||
}
|
||||
|
||||
trait WriteOnlyArray<in T> : ISized {
|
||||
@@ -53,4 +57,4 @@ fun box() : String {
|
||||
System.out?.println(el)
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user