Skip to content

Commit

Permalink
[Native] Always lower a function inside inline fun resolver
Browse files Browse the repository at this point in the history
Even if a function is partially lowered, we will not break
anything if we lower it again. Later we will introduce a new
lowering (the same as SaveInlineFunctionsBeforeInlining for JS)
that will cache functions lowered for the inliner.

#KT-67220
  • Loading branch information
ivandev0 authored and qodana-bot committed Oct 16, 2024
1 parent 9e0d238 commit 0e4e400
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,12 @@ internal class NativeInlineFunctionResolver(

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

if (shouldLower) {
lower(function, functionIsCached)
}
lower(function, functionIsCached)

return function.getOrSaveLoweredInlineFunction()
}
Expand Down

0 comments on commit 0e4e400

Please sign in to comment.