Minor, add comment to synthetic accessor generation for super calls
Also fix "useless elvis" warning in SyntheticAccessorLowering.
This commit is contained in:
@@ -33,7 +33,8 @@ private fun CallableMemberDescriptor.getJvmName() =
|
||||
fun getAccessorNameSuffix(
|
||||
descriptor: CallableMemberDescriptor, superCallDescriptor: ClassDescriptor?, accessorKind: AccessorKind
|
||||
): String {
|
||||
if (accessorKind == AccessorKind.JVM_DEFAULT_COMPATIBILITY) return descriptor.getJvmName() + "$" + AccessorKind.JVM_DEFAULT_COMPATIBILITY.suffix
|
||||
if (accessorKind == AccessorKind.JVM_DEFAULT_COMPATIBILITY)
|
||||
return descriptor.getJvmName() + "$" + AccessorKind.JVM_DEFAULT_COMPATIBILITY.suffix
|
||||
|
||||
val suffix = when (descriptor) {
|
||||
is ConstructorDescriptor ->
|
||||
@@ -45,5 +46,9 @@ fun getAccessorNameSuffix(
|
||||
else ->
|
||||
throw UnsupportedOperationException("Do not know how to create accessor for descriptor $descriptor")
|
||||
}
|
||||
return if (superCallDescriptor == null) suffix else "$suffix\$s${superCallDescriptor.name.asString().hashCode()}"
|
||||
return if (superCallDescriptor == null) suffix else "$suffix\$s${superCallDescriptor.syntheticAccessorToSuperSuffix()}"
|
||||
}
|
||||
|
||||
fun ClassDescriptor.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()
|
||||
|
||||
Reference in New Issue
Block a user