[K/N] Fix references for inline function
Corresponding lowering creating wrappers from JS Backend was used. Also, the lowering was changed to create local function, instead of normal one in outer scope, as a lot of logic from local declarations lowering should be duplicated otherwise for correct type parameters handling. ^KT-38535
This commit is contained in:
+6
-1
@@ -2,7 +2,6 @@ package org.jetbrains.kotlin.backend.konan
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.*
|
||||
import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.common.lower.StringConcatenationLowering
|
||||
import org.jetbrains.kotlin.backend.common.lower.inline.FunctionInlining
|
||||
import org.jetbrains.kotlin.backend.common.lower.inline.LocalClassesExtractionFromInlineFunctionsLowering
|
||||
import org.jetbrains.kotlin.backend.common.lower.inline.LocalClassesInInlineFunctionsLowering
|
||||
@@ -160,6 +159,12 @@ internal val extractLocalClassesFromInlineBodies = makeKonanFileOpPhase(
|
||||
prerequisite = setOf(sharedVariablesPhase), // TODO: add "soft" dependency on inventNamesForLocalClasses
|
||||
)
|
||||
|
||||
internal val wrapInlineDeclarationsWithReifiedTypeParametersLowering = makeKonanFileLoweringPhase(
|
||||
::WrapInlineDeclarationsWithReifiedTypeParametersLowering,
|
||||
name = "WrapInlineDeclarationsWithReifiedTypeParameters",
|
||||
description = "Wrap inline declarations with reified type parameters"
|
||||
)
|
||||
|
||||
internal val inlinePhase = makeKonanFileOpPhase(
|
||||
{ context, irFile ->
|
||||
irFile.acceptChildrenVoid(object : IrElementVisitorVoid {
|
||||
|
||||
+1
@@ -252,6 +252,7 @@ internal val allLoweringsPhase = NamedCompilerPhase(
|
||||
sharedVariablesPhase,
|
||||
inventNamesForLocalClasses,
|
||||
extractLocalClassesFromInlineBodies,
|
||||
wrapInlineDeclarationsWithReifiedTypeParametersLowering,
|
||||
inlinePhase,
|
||||
provisionalFunctionExpressionPhase,
|
||||
postInlinePhase,
|
||||
|
||||
+2
@@ -74,6 +74,8 @@ internal class NativeInlineFunctionResolver(override val context: Context) : Def
|
||||
LocalClassesExtractionFromInlineFunctionsLowering(context).lower(body, notLoweredFunction)
|
||||
}
|
||||
|
||||
WrapInlineDeclarationsWithReifiedTypeParametersLowering(context).lower(body, notLoweredFunction)
|
||||
|
||||
return notLoweredFunction
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user