92cdf24d48
Since inlining is a cross-module operation (we need to know the bodies of inline functions), all lowerings that are supposed to run before the inliner, need to be run on all inline functions.
19 lines
501 B
Kotlin
19 lines
501 B
Kotlin
/*
|
|
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
|
* that can be found in the LICENSE file.
|
|
*/
|
|
|
|
package a
|
|
|
|
fun IntArray.forEachNoInline(block: (Int) -> Unit) = this.forEach { block(it) }
|
|
|
|
inline fun foo(values: IntArray, crossinline block: (Int, Int, Int) -> Int): Int {
|
|
val o = object {
|
|
lateinit var s: String
|
|
var x: Int = 42
|
|
}
|
|
values.forEachNoInline {
|
|
o.x = block(o.x, o.s.length, it)
|
|
}
|
|
return o.x
|
|
} |