JVM IR: support LanguageFeature.UseGetterNameForPropertyAnnotationsMethodOnJvm
This commit is contained in:
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.common.lower.loops.forLoopsPhase
|
|||||||
import org.jetbrains.kotlin.backend.common.phaser.*
|
import org.jetbrains.kotlin.backend.common.phaser.*
|
||||||
import org.jetbrains.kotlin.backend.jvm.lower.*
|
import org.jetbrains.kotlin.backend.jvm.lower.*
|
||||||
import org.jetbrains.kotlin.codegen.OwnerKind
|
import org.jetbrains.kotlin.codegen.OwnerKind
|
||||||
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationWithName
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationWithName
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||||
@@ -71,10 +72,15 @@ private val lateinitPhase = makeIrFilePhase(
|
|||||||
private val propertiesPhase = makeIrFilePhase<JvmBackendContext>(
|
private val propertiesPhase = makeIrFilePhase<JvmBackendContext>(
|
||||||
{ context ->
|
{ context ->
|
||||||
PropertiesLowering(context, JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS) { property ->
|
PropertiesLowering(context, JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS) { property ->
|
||||||
val getterName = property.getter?.let { getter ->
|
val baseName =
|
||||||
context.typeMapper.mapFunctionName(getter, OwnerKind.IMPLEMENTATION)
|
if (context.state.languageVersionSettings.supportsFeature(LanguageFeature.UseGetterNameForPropertyAnnotationsMethodOnJvm)) {
|
||||||
} ?: JvmAbi.getterName(property.name.asString())
|
property.getter?.let { getter ->
|
||||||
JvmAbi.getSyntheticMethodNameForAnnotatedProperty(getterName)
|
context.typeMapper.mapFunctionName(getter, OwnerKind.IMPLEMENTATION)
|
||||||
|
} ?: JvmAbi.getterName(property.name.asString())
|
||||||
|
} else {
|
||||||
|
property.name.asString()
|
||||||
|
}
|
||||||
|
JvmAbi.getSyntheticMethodNameForAnnotatedProperty(baseName)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
name = "Properties",
|
name = "Properties",
|
||||||
|
|||||||
Reference in New Issue
Block a user