mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
- Turn some const conditions into non-const conditions - Make sure inlined const values are used where required (otherwise they are eliminated by POP backward propagation)
15 lines
236 B
Kotlin
Vendored
15 lines
236 B
Kotlin
Vendored
val nonConstFlag = true
|
|
|
|
inline fun <T, R> calc(value : T, fn: (T) -> R) : R = fn(value)
|
|
|
|
inline fun <T> identity(value : T) : T = calc(value) {
|
|
if (nonConstFlag) return it
|
|
it
|
|
}
|
|
|
|
fun foo() {
|
|
val x = identity(1)
|
|
}
|
|
|
|
// 1 GOTO
|