5a1c995b5c
Generate TABLESWITCH/LOOKUPSWITCH bytecode command in case of "when" by enum entries
19 lines
323 B
Kotlin
19 lines
323 B
Kotlin
import kotlin.test.assertEquals
|
|
|
|
enum class Season {
|
|
WINTER
|
|
SPRING
|
|
SUMMER
|
|
AUTUMN
|
|
}
|
|
|
|
fun bar(x : Season) : String {
|
|
when (x) {
|
|
Season.WINTER, Season.SPRING -> return "winter_spring"
|
|
Season.SUMMER, Season.SPRING -> return "summer"
|
|
else -> return "autumn"
|
|
}
|
|
}
|
|
|
|
// 1 TABLESWITCH
|