Do not create new descriptors for "call" instructions. Calls for functions declared in inlineBody will be substituted in second pass
This commit is contained in:
committed by
KonstantinAnisimov
parent
42955526bf
commit
5920e0d8ba
-22
@@ -146,27 +146,6 @@ internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: DeclarationDe
|
|||||||
super.visitVariable(declaration)
|
super.visitVariable(declaration)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------//
|
|
||||||
|
|
||||||
override fun visitCall(expression: IrCall) {
|
|
||||||
|
|
||||||
val oldDescriptor = expression.descriptor as FunctionDescriptor
|
|
||||||
if (oldDescriptor is SimpleFunctionDescriptor) {
|
|
||||||
val newContainingDeclaration = descriptorSubstituteMap.getOrDefault(oldDescriptor, oldDescriptor)
|
|
||||||
val newReturnType = substituteType(oldDescriptor.returnType)!!
|
|
||||||
val newValueParameters = copyValueParameters(oldDescriptor.valueParameters, newContainingDeclaration as CallableDescriptor)
|
|
||||||
val newDescriptor = oldDescriptor
|
|
||||||
.newCopyBuilder()
|
|
||||||
.setReturnType(newReturnType)
|
|
||||||
.setValueParameters(newValueParameters)
|
|
||||||
.setOriginal(oldDescriptor.original)
|
|
||||||
.build()
|
|
||||||
descriptorSubstituteMap[oldDescriptor] = newDescriptor!!
|
|
||||||
}
|
|
||||||
|
|
||||||
super.visitCall(expression)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--- Copy descriptors ------------------------------------------------//
|
//--- Copy descriptors ------------------------------------------------//
|
||||||
|
|
||||||
private fun generateCopyName(name: Name): Name {
|
private fun generateCopyName(name: Name): Name {
|
||||||
@@ -239,7 +218,6 @@ internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: DeclarationDe
|
|||||||
val newValueParameters = copyValueParameters(oldDescriptor.valueParameters, this)
|
val newValueParameters = copyValueParameters(oldDescriptor.valueParameters, this)
|
||||||
val receiverParameterType = substituteType(oldDescriptor.dispatchReceiverParameter?.type)
|
val receiverParameterType = substituteType(oldDescriptor.dispatchReceiverParameter?.type)
|
||||||
val returnType = substituteType(oldDescriptor.returnType)
|
val returnType = substituteType(oldDescriptor.returnType)
|
||||||
assert(newTypeParameters.isEmpty())
|
|
||||||
|
|
||||||
initialize(
|
initialize(
|
||||||
/* receiverParameterType = */ receiverParameterType,
|
/* receiverParameterType = */ receiverParameterType,
|
||||||
|
|||||||
Reference in New Issue
Block a user