Extract utility methods from KotlinSafeDeleteProcessor
This commit is contained in:
@@ -189,4 +189,12 @@ fun PsiElement.isExtensionDeclaration(): Boolean {
|
||||
return callable?.getReceiverTypeRef() != null
|
||||
}
|
||||
|
||||
fun PsiElement.isObjectLiteral(): Boolean = this is JetObjectDeclaration && isObjectLiteral()
|
||||
fun PsiElement.isObjectLiteral(): Boolean = this is JetObjectDeclaration && isObjectLiteral()
|
||||
|
||||
fun PsiElement.deleteElementAndCleanParent() {
|
||||
val parent = getParent()
|
||||
|
||||
JetPsiUtil.deleteElementWithDelimiters(this)
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
JetPsiUtil.deleteChildlessElement(parent, this.getClass() as Class<PsiElement>)
|
||||
}
|
||||
Reference in New Issue
Block a user