Move call site descriptor substitutor to main algotithm

This commit is contained in:
Konstantin Anisimov
2017-04-12 10:14:46 +07:00
committed by KonstantinAnisimov
parent bc2d635ce7
commit 1f1de99878
2 changed files with 4 additions and 4 deletions
@@ -54,10 +54,7 @@ internal class DeepCopyIrTreeWithDescriptors(val targetScope: ScopeWithIr,
fun copy(irElement: IrElement, typeSubstitutor: TypeSubstitutor?): IrElement {
this.typeSubstitutor = typeSubstitutor
descriptorSubstituteMap.clear()
irElement.acceptChildrenVoid(DescriptorCollector())
// Transform calls to object that might be returned from inline function call.
targetScope.irElement.transformChildrenVoid(descriptorSubstitutorForExternalScope)
return irElement.accept(InlineCopyIr(), null)
}
@@ -68,7 +68,10 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoidW
copyIrElement = DeepCopyIrTreeWithDescriptors(currentScope!!, context) // Create DeepCopy for current scope.
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
}
//-------------------------------------------------------------------------//