Skip to content

Commit

Permalink
[Native] Use the original function to lower inside inline fun resolver
Browse files Browse the repository at this point in the history
We don't need to use `possiblyLoweredFunction` because it will
always be the same as `irFunction`.

#KT-67220
  • Loading branch information
ivandev0 authored and qodana-bot committed Oct 16, 2024
1 parent 7928a62 commit 9d3e850
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ internal class NativeInlineFunctionResolver(

val moduleDeserializer = context.irLinker.getCachedDeclarationModuleDeserializer(function)
val functionIsCached = moduleDeserializer != null && function.body == null
val (possiblyLoweredFunction, shouldLower) = if (functionIsCached) {
val shouldLower = if (functionIsCached) {
// The function is cached, get its body from the IR linker.
val (firstAccess, _) = moduleDeserializer.deserializeInlineFunction(function)
function to firstAccess
firstAccess
} else {
function to true
true
}

if (shouldLower) {
lower(possiblyLoweredFunction, functionIsCached)
lower(function, functionIsCached)
if (!functionIsCached) {
possiblyLoweredFunction.getOrSaveLoweredInlineFunction()
function.getOrSaveLoweredInlineFunction()
}
}
return possiblyLoweredFunction
return function
}

private fun lower(function: IrFunction, functionIsCached: Boolean) {
Expand Down

0 comments on commit 9d3e850

Please sign in to comment.