From 485ada7b906cd17aa511cecc726d57d721b4fde6 Mon Sep 17 00:00:00 2001 From: Bart van Helvert Date: Tue, 8 Sep 2020 01:12:12 +0200 Subject: [PATCH] Move getColon from KtClass to KtClassOrObject Makes it possible to retrieve the colon from a KtObjectDeclaration. --- compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt | 2 -- compiler/psi/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt index 958f66636c1..7769c36d28d 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt @@ -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 = body?.properties.orEmpty() fun isInterface(): Boolean = diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt index 77b50efb9e5..f10262abbec 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt @@ -35,6 +35,8 @@ abstract class KtClassOrObject : constructor(node: ASTNode) : super(node) constructor(stub: KotlinClassOrObjectStub, nodeType: IStubElementType<*, *>) : super(stub, nodeType) + fun getColon(): PsiElement? = findChildByType(KtTokens.COLON) + fun getSuperTypeList(): KtSuperTypeList? = getStubOrPsiChild(KtStubElementTypes.SUPER_TYPE_LIST) override fun getSuperTypeListEntries(): List = getSuperTypeList()?.entries.orEmpty() @@ -61,7 +63,7 @@ abstract class KtClassOrObject : if (specifierList.entries.size > 1) { EditCommaSeparatedListHelper.removeItem(superTypeListEntry) } else { - deleteChildRange(findChildByType(KtTokens.COLON) ?: specifierList, specifierList) + deleteChildRange(getColon() ?: specifierList, specifierList) } }