FIR IDE: introduce symbol modality
This commit is contained in:
+2
-2
@@ -16,10 +16,10 @@ abstract class KtTypeAliasSymbol : KtClassLikeSymbol() {
|
||||
final override val symbolKind: KtSymbolKind get() = KtSymbolKind.TOP_LEVEL
|
||||
}
|
||||
|
||||
abstract class KtClassOrObjectSymbol : KtClassLikeSymbol(), KtSymbolWithTypeParameters {
|
||||
abstract class KtClassOrObjectSymbol : KtClassLikeSymbol(), KtSymbolWithTypeParameters, KtSymbolWithModality<KtSymbolModality> {
|
||||
abstract val classKind: KtClassKind
|
||||
}
|
||||
|
||||
enum class KtClassKind {
|
||||
CLASS, ABSTRACT_CLASS, ENUM_CLASS, ENUM_ENTRY, ANNOTATION_CLASS, OBJECT, COMPANION_OBJECT, INTERFACE
|
||||
CLASS, ENUM_CLASS, ENUM_ENTRY, ANNOTATION_CLASS, OBJECT, COMPANION_OBJECT, INTERFACE
|
||||
}
|
||||
+6
-1
@@ -15,7 +15,12 @@ abstract class KtAnonymousFunctionSymbol : KtFunctionLikeSymbol() {
|
||||
final override val symbolKind: KtSymbolKind get() = KtSymbolKind.LOCAL
|
||||
}
|
||||
|
||||
abstract class KtFunctionSymbol : KtFunctionLikeSymbol(), KtNamedSymbol, KtPossibleExtensionSymbol, KtSymbolWithTypeParameters {
|
||||
abstract class KtFunctionSymbol : KtFunctionLikeSymbol(),
|
||||
KtNamedSymbol,
|
||||
KtPossibleExtensionSymbol,
|
||||
KtSymbolWithTypeParameters,
|
||||
KtSymbolWithModality<KtCommonSymbolModality> {
|
||||
|
||||
abstract val isSuspend: Boolean
|
||||
abstract val isOperator: Boolean
|
||||
abstract val fqName: FqName?
|
||||
|
||||
+4
@@ -7,6 +7,8 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import org.jetbrains.kotlin.idea.frontend.api.ValidityOwner
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
|
||||
abstract class KtSymbolProvider : ValidityOwner {
|
||||
@@ -38,4 +40,6 @@ abstract class KtSymbolProvider : ValidityOwner {
|
||||
* @return symbol with specified [classId] or `null` in case such symbol is not found
|
||||
*/
|
||||
abstract fun getClassOrObjectSymbolByClassId(classId: ClassId): KtClassOrObjectSymbol?
|
||||
|
||||
abstract fun getTopLevelCallableSymbols(packageFqName: FqName, name: Name): Sequence<KtSymbol>
|
||||
}
|
||||
+2
-2
@@ -19,12 +19,12 @@ abstract class KtVariableSymbol : KtVariableLikeSymbol() {
|
||||
abstract val isVal: Boolean
|
||||
}
|
||||
|
||||
abstract class KtFieldSymbol : KtVariableSymbol() {
|
||||
abstract class KtFieldSymbol : KtVariableSymbol(), KtSymbolWithModality<KtCommonSymbolModality> {
|
||||
final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER
|
||||
}
|
||||
|
||||
// TODO getters & setters
|
||||
abstract class KtPropertySymbol : KtVariableSymbol(), KtPossibleExtensionSymbol {
|
||||
abstract class KtPropertySymbol : KtVariableSymbol(), KtPossibleExtensionSymbol, KtSymbolWithModality<KtCommonSymbolModality> {
|
||||
abstract val fqName: FqName
|
||||
}
|
||||
|
||||
|
||||
@@ -32,3 +32,17 @@ interface KtPossibleExtensionSymbol {
|
||||
interface KtSymbolWithTypeParameters {
|
||||
val typeParameters: List<KtTypeParameterSymbol>
|
||||
}
|
||||
|
||||
interface KtSymbolWithModality<M : KtSymbolModality> {
|
||||
val modality: M
|
||||
}
|
||||
|
||||
sealed class KtSymbolModality {
|
||||
object SEALED : KtSymbolModality()
|
||||
}
|
||||
|
||||
sealed class KtCommonSymbolModality : KtSymbolModality() {
|
||||
object FINAL : KtCommonSymbolModality()
|
||||
object ABSTRACT : KtCommonSymbolModality()
|
||||
object OPEN : KtCommonSymbolModality()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user