don't forget to put receiver on stack when calling extension functions

This commit is contained in:
Dmitry Jemerov
2011-05-27 18:11:42 +04:00
parent ff6fcabd00
commit 6dfa8ca8c6
5 changed files with 52 additions and 21 deletions
@@ -0,0 +1,14 @@
fun StringBuilder.takeFirst(): Char {
if (this.length() == 0) return '\0'
val c = this.charAt(0)
this.deleteCharAt(0)
return c
}
fun foo(expr: StringBuilder): Int {
val c = expr.takeFirst()
when(c) {
'\0' => throw new Exception("zero")
else => throw new Exception("nonzero" + c)
}
}