Fixes after review: ConvertMemberToExtensionIntention.convert moved to companion object
This commit is contained in:
+6
-4
@@ -70,10 +70,6 @@ class ConvertMemberToExtensionIntention : SelfTargetingRangeIntention<KtCallable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun convert(element: KtCallableDeclaration): KtCallableDeclaration {
|
|
||||||
return createExtensionCallableAndPrepareBodyToSelect(element).first
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createExtensionCallableAndPrepareBodyToSelect(element: KtCallableDeclaration): Pair<KtCallableDeclaration, KtExpression?> {
|
private fun createExtensionCallableAndPrepareBodyToSelect(element: KtCallableDeclaration): Pair<KtCallableDeclaration, KtExpression?> {
|
||||||
val descriptor = element.resolveToDescriptor()
|
val descriptor = element.resolveToDescriptor()
|
||||||
val containingClass = descriptor.containingDeclaration as ClassDescriptor
|
val containingClass = descriptor.containingDeclaration as ClassDescriptor
|
||||||
@@ -211,4 +207,10 @@ class ConvertMemberToExtensionIntention : SelfTargetingRangeIntention<KtCallable
|
|||||||
val text = allTypeParameters.map { it.text }.joinToString(",", "<", ">")
|
val text = allTypeParameters.map { it.text }.joinToString(",", "<", ">")
|
||||||
return KtPsiFactory(member).createDeclaration<KtFunction>("fun $text foo()").typeParameterList
|
return KtPsiFactory(member).createDeclaration<KtFunction>("fun $text foo()").typeParameterList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun convert(element: KtCallableDeclaration): KtCallableDeclaration {
|
||||||
|
return ConvertMemberToExtensionIntention().createExtensionCallableAndPrepareBodyToSelect(element).first
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ class MigrateExternalExtensionFix(declaration: KtNamedDeclaration)
|
|||||||
convertNativeAnnotationToJsName(memberDeclaration, annotations)
|
convertNativeAnnotationToJsName(memberDeclaration, annotations)
|
||||||
annotations.nativeAnnotation.delete()
|
annotations.nativeAnnotation.delete()
|
||||||
} else {
|
} else {
|
||||||
val externalDeclaration = ConvertMemberToExtensionIntention().convert(memberDeclaration)
|
val externalDeclaration = ConvertMemberToExtensionIntention.convert(memberDeclaration)
|
||||||
fixExtensionMemberDeclaration(externalDeclaration, null)
|
fixExtensionMemberDeclaration(externalDeclaration, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user