[IR] Store original function in the IrInlinedBlock
In Native and JS, there is a special logic where the compiler saves a copy of inlined function (see `InlineFunctionsSupport`). This copy is used in the IR inliner. Because of that, we can't really compare inlined function with other functions directly. We need to get `originalFunction` first and save it.
This commit is contained in:
+1
-4
@@ -57,10 +57,7 @@ abstract class UsefulDeclarationProcessor(
|
||||
super.visitBlock(expression, data)
|
||||
|
||||
if (expression is IrReturnableBlock) {
|
||||
// We need to extract `originalFunction` here because saved `inlineFunction`
|
||||
// is actually a copy made in `SaveInlineFunctionsBeforeInlining`.
|
||||
// Without this, we are not going to find proper intersection in the `saveOnlyIntersectionOfNextDeclarationsFor` method.
|
||||
expression.inlineFunction?.originalFunction?.addToUsefulPolyfilledDeclarations()
|
||||
expression.inlineFunction?.addToUsefulPolyfilledDeclarations()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ class FunctionInlining(
|
||||
|
||||
val substituteMap = mutableMapOf<IrValueParameter, IrExpression>()
|
||||
|
||||
fun inline() = inlineFunction(callSite, callee, callee, true)
|
||||
fun inline() = inlineFunction(callSite, callee, callee.originalFunction, true)
|
||||
|
||||
private fun <E : IrElement> E.copy(): E {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
||||
Reference in New Issue
Block a user