Compile-time constants

This commit is contained in:
Andrey Breslav
2011-08-03 14:05:07 +04:00
parent 7b27ac1766
commit 4c8aec3b1b
91 changed files with 1271 additions and 331 deletions
@@ -1,5 +1,5 @@
fun StringBuilder.takeFirst(): Char {
if (this.length() == 0) return '\0'
if (this.length() == 0) return 0.chr
val c = this.charAt(0)
this.deleteCharAt(0)
return c
@@ -8,7 +8,7 @@ fun StringBuilder.takeFirst(): Char {
fun foo(expr: StringBuilder): Int {
val c = expr.takeFirst()
when(c) {
'\0' => throw Exception("zero")
0.chr => throw Exception("zero")
else => throw Exception("nonzero" + c)
}
}