When2Switch: generate ifnonnull check for nullable values before *switch-opcode

This commit is contained in:
Denis Zharkov
2014-07-17 11:59:58 +04:00
committed by Evgeny Gerashchenko
parent 706bbd7b72
commit 8d8c3d2b9e
11 changed files with 218 additions and 13 deletions

View File

@@ -0,0 +1,18 @@
fun foo1(x : String?) : String {
when (x) {
"abc", "cde" -> return "abc_cde"
"efg", "ghi", null -> return "efg_ghi"
}
return "other"
}
fun foo2(x : String?) : String {
when (x) {
"abc", "cde" -> return "abc_cde"
"efg", "ghi" -> return "efg_ghi"
else -> return "other"
}
}
// 2 LOOKUPSWITCH