Pseudocode: Generate proper instructions for when conditions. Eliminate unnecessary magics

This commit is contained in:
Alexey Sedunov
2014-06-26 13:06:26 +04:00
parent fd21b6cbe9
commit d636d362b7
8 changed files with 180 additions and 20 deletions
@@ -0,0 +1,12 @@
import java.util.Collections
fun foo(a: Number) {
val t = when (a) {
1 -> "1"
in Collections.singleton(2) -> "2"
is Int -> "Int"
!in Collections.singleton(3) -> "!3"
!is Number -> "!Number"
else -> null
}
}