Fixes after review: ConvertMemberToExtensionIntention.convert moved to companion object

This commit is contained in:
qx
2017-05-04 13:37:57 +03:00
parent f163788821
commit 0ba4a82ca6
2 changed files with 7 additions and 5 deletions
@@ -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?> {
val descriptor = element.resolveToDescriptor()
val containingClass = descriptor.containingDeclaration as ClassDescriptor
@@ -211,4 +207,10 @@ class ConvertMemberToExtensionIntention : SelfTargetingRangeIntention<KtCallable
val text = allTypeParameters.map { it.text }.joinToString(",", "<", ">")
return KtPsiFactory(member).createDeclaration<KtFunction>("fun $text foo()").typeParameterList
}
companion object {
fun convert(element: KtCallableDeclaration): KtCallableDeclaration {
return ConvertMemberToExtensionIntention().createExtensionCallableAndPrepareBodyToSelect(element).first
}
}
}
@@ -75,7 +75,7 @@ class MigrateExternalExtensionFix(declaration: KtNamedDeclaration)
convertNativeAnnotationToJsName(memberDeclaration, annotations)
annotations.nativeAnnotation.delete()
} else {
val externalDeclaration = ConvertMemberToExtensionIntention().convert(memberDeclaration)
val externalDeclaration = ConvertMemberToExtensionIntention.convert(memberDeclaration)
fixExtensionMemberDeclaration(externalDeclaration, null)
}
}