mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
Generate TABLESWITCH/LOOKUPSWITCH bytecode operation for when operator by String constants
13 lines
229 B
Kotlin
Vendored
13 lines
229 B
Kotlin
Vendored
fun foo(x : String) : String {
|
|
assert("abz]".hashCode() == "aby|".hashCode())
|
|
|
|
when (x) {
|
|
"abz]", "cde" -> return "abz_cde"
|
|
"aby|", "ghi" -> return "aby_ghi"
|
|
}
|
|
|
|
return "other"
|
|
}
|
|
|
|
// 1 LOOKUPSWITCH
|