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?
|
private val _stub: KotlinClassStub?
|
||||||
get() = stub as? KotlinClassStub
|
get() = stub as? KotlinClassStub
|
||||||
|
|
||||||
fun getColon(): PsiElement? = findChildByType(KtTokens.COLON)
|
|
||||||
|
|
||||||
fun getProperties(): List<KtProperty> = body?.properties.orEmpty()
|
fun getProperties(): List<KtProperty> = body?.properties.orEmpty()
|
||||||
|
|
||||||
fun isInterface(): Boolean =
|
fun isInterface(): Boolean =
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ abstract class KtClassOrObject :
|
|||||||
constructor(node: ASTNode) : super(node)
|
constructor(node: ASTNode) : super(node)
|
||||||
constructor(stub: KotlinClassOrObjectStub<out KtClassOrObject>, nodeType: IStubElementType<*, *>) : super(stub, nodeType)
|
constructor(stub: KotlinClassOrObjectStub<out KtClassOrObject>, nodeType: IStubElementType<*, *>) : super(stub, nodeType)
|
||||||
|
|
||||||
|
fun getColon(): PsiElement? = findChildByType(KtTokens.COLON)
|
||||||
|
|
||||||
fun getSuperTypeList(): KtSuperTypeList? = getStubOrPsiChild(KtStubElementTypes.SUPER_TYPE_LIST)
|
fun getSuperTypeList(): KtSuperTypeList? = getStubOrPsiChild(KtStubElementTypes.SUPER_TYPE_LIST)
|
||||||
|
|
||||||
override fun getSuperTypeListEntries(): List<KtSuperTypeListEntry> = getSuperTypeList()?.entries.orEmpty()
|
override fun getSuperTypeListEntries(): List<KtSuperTypeListEntry> = getSuperTypeList()?.entries.orEmpty()
|
||||||
@@ -61,7 +63,7 @@ abstract class KtClassOrObject :
|
|||||||
if (specifierList.entries.size > 1) {
|
if (specifierList.entries.size > 1) {
|
||||||
EditCommaSeparatedListHelper.removeItem<KtElement>(superTypeListEntry)
|
EditCommaSeparatedListHelper.removeItem<KtElement>(superTypeListEntry)
|
||||||
} else {
|
} else {
|
||||||
deleteChildRange(findChildByType<PsiElement>(KtTokens.COLON) ?: specifierList, specifierList)
|
deleteChildRange(getColon() ?: specifierList, specifierList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user