Move getColon from KtClass to KtClassOrObject

Makes it possible to retrieve the colon from a KtObjectDeclaration.
This commit is contained in:
Bart van Helvert
2020-09-08 01:12:12 +02:00
committed by Petukhov Victor
parent 4d5b32b140
commit 485ada7b90
2 changed files with 3 additions and 3 deletions
@@ -23,8 +23,6 @@ open class KtClass : KtClassOrObject {
private val _stub: KotlinClassStub?
get() = stub as? KotlinClassStub
fun getColon(): PsiElement? = findChildByType(KtTokens.COLON)
fun getProperties(): List<KtProperty> = body?.properties.orEmpty()
fun isInterface(): Boolean =
@@ -35,6 +35,8 @@ abstract class KtClassOrObject :
constructor(node: ASTNode) : super(node)
constructor(stub: KotlinClassOrObjectStub<out KtClassOrObject>, nodeType: IStubElementType<*, *>) : super(stub, nodeType)
fun getColon(): PsiElement? = findChildByType(KtTokens.COLON)
fun getSuperTypeList(): KtSuperTypeList? = getStubOrPsiChild(KtStubElementTypes.SUPER_TYPE_LIST)
override fun getSuperTypeListEntries(): List<KtSuperTypeListEntry> = getSuperTypeList()?.entries.orEmpty()
@@ -61,7 +63,7 @@ abstract class KtClassOrObject :
if (specifierList.entries.size > 1) {
EditCommaSeparatedListHelper.removeItem<KtElement>(superTypeListEntry)
} else {
deleteChildRange(findChildByType<PsiElement>(KtTokens.COLON) ?: specifierList, specifierList)
deleteChildRange(getColon() ?: specifierList, specifierList)
}
}