IR metadata source: extract & use declaration name
This commit is contained in:
+1
-1
@@ -469,7 +469,7 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
|
||||
}
|
||||
|
||||
private val IrFunction.originalName: Name
|
||||
get() = (metadata as? MetadataSource.Function)?.descriptor?.name ?: name
|
||||
get() = metadata?.name ?: name
|
||||
|
||||
private fun JvmIrBuilder.generateSignature(target: IrFunctionSymbol): IrExpression =
|
||||
irCall(backendContext.ir.symbols.signatureStringIntrinsic).apply {
|
||||
|
||||
@@ -9,13 +9,24 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
interface MetadataSource {
|
||||
open class Class(val descriptor: ClassDescriptor) : MetadataSource
|
||||
val name: Name?
|
||||
|
||||
open class File(val descriptors: List<DeclarationDescriptor>) : MetadataSource
|
||||
abstract class DescriptorBased<D : DeclarationDescriptor> internal constructor(val descriptor: D) : MetadataSource {
|
||||
override val name: Name
|
||||
get() = descriptor.name
|
||||
}
|
||||
|
||||
open class Function(val descriptor: FunctionDescriptor) : MetadataSource
|
||||
open class Class(descriptor: ClassDescriptor) : DescriptorBased<ClassDescriptor>(descriptor)
|
||||
|
||||
open class Property(val descriptor: PropertyDescriptor) : MetadataSource
|
||||
open class File(val descriptors: List<DeclarationDescriptor>) : MetadataSource {
|
||||
override val name: Name?
|
||||
get() = null
|
||||
}
|
||||
|
||||
open class Function(descriptor: FunctionDescriptor) : DescriptorBased<FunctionDescriptor>(descriptor)
|
||||
|
||||
open class Property(descriptor: PropertyDescriptor) : DescriptorBased<PropertyDescriptor>(descriptor)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user