pull https://github.com/develar/kotlin ecma5-iter3 Make most of the tests work.

Thanks to develar.
This commit is contained in:
Pavel V. Talanov
2012-07-03 15:27:37 +04:00
75 changed files with 7964 additions and 1165 deletions
@@ -0,0 +1,33 @@
package foo
class SimpleEnumerator {
private var counter = 0
fun getNext(): String {
counter++;
return counter.toString()
}
fun hasMoreElements(): Boolean = counter < 1
}
class SimpleEnumeratorWrapper(private val enumerator: SimpleEnumerator) {
val hasNext: Boolean
get() = enumerator.hasMoreElements()
fun next() = enumerator.getNext()
}
fun SimpleEnumerator.iterator(): SimpleEnumeratorWrapper {
return SimpleEnumeratorWrapper(this)
}
fun box(): Boolean {
var o = ""
val enumerator = SimpleEnumerator()
for (s in enumerator) {
o += s;
}
return o == "1"
}