KotlinChangeSignatureData: cleanup code
This commit is contained in:
+6
-5
@@ -78,9 +78,11 @@ class KotlinChangeSignatureData(
|
||||
val receiverName = suggestReceiverNames(baseDeclaration.project, baseDescriptor).first()
|
||||
val receiverTypeText = (baseDeclaration as? KtCallableDeclaration)?.receiverTypeReference?.text
|
||||
?: IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.renderType(receiverType)
|
||||
return KotlinParameterInfo(callableDescriptor = baseDescriptor,
|
||||
return KotlinParameterInfo(
|
||||
callableDescriptor = baseDescriptor,
|
||||
name = receiverName,
|
||||
originalTypeInfo = KotlinTypeInfo(false, receiverType, receiverTypeText))
|
||||
originalTypeInfo = KotlinTypeInfo(false, receiverType, receiverTypeText)
|
||||
)
|
||||
}
|
||||
|
||||
override val original: KotlinMethodDescriptor
|
||||
@@ -89,7 +91,7 @@ class KotlinChangeSignatureData(
|
||||
override val primaryCallables: Collection<KotlinCallableDefinitionUsage<PsiElement>> by lazy {
|
||||
descriptorsForSignatureChange.map {
|
||||
val declaration = DescriptorToSourceUtilsIde.getAnyDeclaration(baseDeclaration.project, it)
|
||||
assert(declaration != null) { "No declaration found for " + baseDescriptor }
|
||||
assert(declaration != null) { "No declaration found for $baseDescriptor" }
|
||||
KotlinCallableDefinitionUsage(declaration!!, it, null, null)
|
||||
}
|
||||
}
|
||||
@@ -104,8 +106,7 @@ class KotlinChangeSignatureData(
|
||||
|
||||
if (primaryDeclaration.isExpectDeclaration()) {
|
||||
return@flatMapTo primaryDeclaration.actualsForExpected().mapNotNull {
|
||||
val descriptor = it.unsafeResolveToDescriptor()
|
||||
val callableDescriptor = when (descriptor) {
|
||||
val callableDescriptor = when (val descriptor = it.unsafeResolveToDescriptor()) {
|
||||
is CallableDescriptor -> descriptor
|
||||
is ClassDescriptor -> descriptor.unsubstitutedPrimaryConstructor ?: return@mapNotNull null
|
||||
else -> return@mapNotNull null
|
||||
|
||||
Reference in New Issue
Block a user