When by enum:
Generate TABLESWITCH/LOOKUPSWITCH bytecode command in case of "when" by enum entries
This commit is contained in:
committed by
Evgeny Gerashchenko
parent
b2aa249817
commit
5a1c995b5c
@@ -0,0 +1,18 @@
|
||||
enum class Season {
|
||||
WINTER
|
||||
SPRING
|
||||
SUMMER
|
||||
AUTUMN
|
||||
}
|
||||
|
||||
fun foo(): Season = Season.SPRING
|
||||
fun bar(): Season = Season.SPRING
|
||||
|
||||
fun box() : String {
|
||||
when (foo()) {
|
||||
bar() -> return "OK"
|
||||
else -> return "fail"
|
||||
}
|
||||
}
|
||||
|
||||
// 0 TABLESWITCH
|
||||
Reference in New Issue
Block a user