Extract IrClass.syntheticAccessorToSuperSuffix()

This commit is contained in:
Mikhail Glukhikh
2020-05-18 18:22:33 +03:00
parent 66da676b9e
commit bf66929b5b
@@ -527,7 +527,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
parentAsClass.isJvmInterface -> if (!Visibilities.isPrivate(visibility)) "\$jd" else ""
// Accessor for _s_uper-qualified call
superQualifier != null -> "\$s" + superQualifier.descriptor.syntheticAccessorToSuperSuffix()
superQualifier != null -> "\$s" + superQualifier.owner.syntheticAccessorToSuperSuffix()
// Access to static members that need an accessor must be because they are inherited,
// hence accessed on a _s_upertype.
@@ -556,7 +556,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
// Static accesses that need an accessor must be due to being inherited, hence accessed on a
// _s_upertype
return "p" + if (isStatic) "\$s" + parentAsClass.descriptor.syntheticAccessorToSuperSuffix() else ""
return "p" + if (isStatic) "\$s" + parentAsClass.syntheticAccessorToSuperSuffix() else ""
}
private val Visibility.isPrivate
@@ -635,4 +635,10 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
private fun IrFunction.isCoroutineIntrinsic(): Boolean =
(name.asString() == "suspendCoroutine" && getPackageFragment()?.fqName == FqName("kotlin.coroutines")) ||
(name.asString() == "suspendCoroutineUninterceptedOrReturn" && getPackageFragment()?.fqName == FqName("kotlin.coroutines.intrinsics"))
(name.asString() == "suspendCoroutineUninterceptedOrReturn" && getPackageFragment()?.fqName == FqName("kotlin.coroutines.intrinsics"))
private fun IrClass.syntheticAccessorToSuperSuffix(): String =
// TODO: change this to `fqNameUnsafe.asString().replace(".", "_")` as soon as we're ready to break compatibility with pre-KT-21178 code
name.asString().hashCode().toString()