Extract utility methods from KotlinSafeDeleteProcessor

This commit is contained in:
Alexey Sedunov
2014-01-28 14:44:46 +04:00
parent 8a1ffeea70
commit 374682e404
7 changed files with 163 additions and 156 deletions
@@ -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>)
}