JVM_IR: do not rely on DescriptorWithContainerSource in InlineCodegen
This commit is contained in:
+10
@@ -13,9 +13,12 @@ import org.jetbrains.kotlin.codegen.StackValue
|
||||
import org.jetbrains.kotlin.codegen.ValueKind
|
||||
import org.jetbrains.kotlin.codegen.inline.*
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBasedPropertyDescriptor
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBasedSimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
@@ -161,6 +164,13 @@ class IrInlineCodegen(
|
||||
::IrDefaultLambda
|
||||
)
|
||||
}
|
||||
|
||||
override fun isLoadedFromBytecode(memberDescriptor: CallableMemberDescriptor): Boolean =
|
||||
when (memberDescriptor) {
|
||||
is IrBasedSimpleFunctionDescriptor -> memberDescriptor.owner.classId != null
|
||||
is IrBasedPropertyDescriptor -> memberDescriptor.owner.classId != null
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
class IrExpressionLambdaImpl(
|
||||
|
||||
+7
-1
@@ -394,7 +394,7 @@ fun IrSimpleType.isRawType(): Boolean =
|
||||
hasAnnotation(JvmGeneratorExtensions.RAW_TYPE_ANNOTATION_FQ_NAME)
|
||||
|
||||
internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendContext, name: String): Boolean? {
|
||||
val classId = (function.containerSource as? JvmPackagePartSource)?.classId ?: (function.parent as? IrClass)?.classId ?: return null
|
||||
val classId = function.classId ?: return null
|
||||
val originalDescriptor = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod.descriptor
|
||||
val descriptor = if (function.isSuspend)
|
||||
listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation"))
|
||||
@@ -403,6 +403,12 @@ internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendCo
|
||||
return classFileContainsMethod(classId, context.state, Method(name, descriptor))
|
||||
}
|
||||
|
||||
val IrFunction.classId: ClassId?
|
||||
get() = (containerSource as? JvmPackagePartSource)?.classId ?: (parent as? IrClass)?.classId
|
||||
|
||||
val IrProperty.classId: ClassId?
|
||||
get() = (containerSource as? JvmPackagePartSource)?.classId ?: (parent as? IrClass)?.classId
|
||||
|
||||
// Translated into IR-based terms from classifierDescriptor?.classId
|
||||
val IrClass.classId: ClassId?
|
||||
get() = when (val parent = parent) {
|
||||
|
||||
Reference in New Issue
Block a user