Move call site descriptor substitutor to main algotithm
This commit is contained in:
committed by
KonstantinAnisimov
parent
bc2d635ce7
commit
1f1de99878
-3
@@ -54,10 +54,7 @@ internal class DeepCopyIrTreeWithDescriptors(val targetScope: ScopeWithIr,
|
|||||||
fun copy(irElement: IrElement, typeSubstitutor: TypeSubstitutor?): IrElement {
|
fun copy(irElement: IrElement, typeSubstitutor: TypeSubstitutor?): IrElement {
|
||||||
|
|
||||||
this.typeSubstitutor = typeSubstitutor
|
this.typeSubstitutor = typeSubstitutor
|
||||||
descriptorSubstituteMap.clear()
|
|
||||||
irElement.acceptChildrenVoid(DescriptorCollector())
|
irElement.acceptChildrenVoid(DescriptorCollector())
|
||||||
// Transform calls to object that might be returned from inline function call.
|
|
||||||
targetScope.irElement.transformChildrenVoid(descriptorSubstitutorForExternalScope)
|
|
||||||
return irElement.accept(InlineCopyIr(), null)
|
return irElement.accept(InlineCopyIr(), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -68,7 +68,10 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoidW
|
|||||||
|
|
||||||
copyIrElement = DeepCopyIrTreeWithDescriptors(currentScope!!, context) // Create DeepCopy for current scope.
|
copyIrElement = DeepCopyIrTreeWithDescriptors(currentScope!!, context) // Create DeepCopy for current scope.
|
||||||
functionDeclaration.transformChildrenVoid(this) // Process recursive inline.
|
functionDeclaration.transformChildrenVoid(this) // Process recursive inline.
|
||||||
return inlineFunction(irCall, functionDeclaration) // Return newly created IrInlineBody instead of IrCall.
|
val inlineFunctionBody = inlineFunction(irCall, functionDeclaration) // Return newly created IrInlineBody instead of IrCall.
|
||||||
|
currentScope!!.irElement.transformChildrenVoid( // Transform calls to object that might be returned from inline function call.
|
||||||
|
copyIrElement!!.descriptorSubstitutorForExternalScope)
|
||||||
|
return inlineFunctionBody
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------//
|
//-------------------------------------------------------------------------//
|
||||||
|
|||||||
Reference in New Issue
Block a user