Files
kotlin/compiler/testData/codegen/bytecodeText/whenStringOptimization/statement.kt
Denis Zharkov d4cb822ee8 When by String constants:
Generate TABLESWITCH/LOOKUPSWITCH bytecode operation for when operator by String constants
2014-07-21 17:13:56 +04:00

20 lines
346 B
Kotlin
Vendored

fun foo1(x : String) : String {
when (x) {
"abc", "cde" -> return "abc_cde"
"efg", "ghi" -> 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