Move getColon from KtClass to KtClassOrObject
Makes it possible to retrieve the colon from a KtObjectDeclaration.
This commit is contained in:
committed by
Petukhov Victor
parent
4d5b32b140
commit
485ada7b90
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user