[FIR IDE] Add fir data into symbols to support FIR LC
This commit is contained in:
committed by
Ilya Kirillov
parent
3d93503894
commit
b423da106f
+9
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtNamedSymbol
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.*
|
||||
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -35,6 +35,7 @@ object DebugSymbolRenderer {
|
||||
null -> "null"
|
||||
is String -> value
|
||||
is Boolean -> value.toString()
|
||||
is Long -> value.toString()
|
||||
is Name -> value.asString()
|
||||
is FqName -> value.asString()
|
||||
is ClassId -> value.asString()
|
||||
@@ -51,10 +52,17 @@ object DebugSymbolRenderer {
|
||||
is KtFunctionSymbol -> renderValue(value.callableIdIfNonLocal ?: "<local>/${value.name}")
|
||||
is KtConstructorSymbol -> "<constructor>"
|
||||
is KtNamedSymbol -> renderValue(value.name)
|
||||
is KtPropertyGetterSymbol -> "<getter>"
|
||||
is KtPropertySetterSymbol -> "<setter>"
|
||||
else -> TODO(value::class.toString())
|
||||
}
|
||||
"${value::class.simpleName!!}($symbolTag)"
|
||||
}
|
||||
is KtSimpleConstantValue<*> -> renderValue(value.constant)
|
||||
is KtNamedConstantValue -> "${renderValue(value.name)} = ${renderValue(value.expression)}"
|
||||
is KtAnnotationCall ->
|
||||
"${renderValue(value.classId)}${value.arguments.joinToString(prefix = "(", postfix = ")") { renderValue(it) }}"
|
||||
|
||||
else -> value::class.simpleName!!
|
||||
}
|
||||
|
||||
|
||||
+13
-1
@@ -7,6 +7,8 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.*
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType
|
||||
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
sealed class KtClassifierSymbol : KtSymbol, KtNamedSymbol
|
||||
@@ -31,9 +33,19 @@ abstract class KtTypeAliasSymbol : KtClassLikeSymbol() {
|
||||
|
||||
abstract class KtClassOrObjectSymbol : KtClassLikeSymbol(),
|
||||
KtSymbolWithTypeParameters,
|
||||
KtSymbolWithModality<KtSymbolModality> {
|
||||
KtSymbolWithModality<KtSymbolModality>,
|
||||
KtSymbolWithVisibility,
|
||||
KtAnnotatedSymbol {
|
||||
abstract val classKind: KtClassKind
|
||||
|
||||
abstract val isInner: Boolean
|
||||
|
||||
abstract val companionObject: KtClassOrObjectSymbol?
|
||||
|
||||
abstract val superTypes: List<KtType>
|
||||
|
||||
abstract val primaryConstructor: KtConstructorSymbol?
|
||||
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtClassOrObjectSymbol>
|
||||
}
|
||||
|
||||
|
||||
+8
-3
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
sealed class KtFunctionLikeSymbol : KtCallableSymbol(), KtTypedSymbol, KtSymbolWithKind {
|
||||
abstract class KtFunctionLikeSymbol : KtCallableSymbol(), KtTypedSymbol, KtSymbolWithKind {
|
||||
abstract val valueParameters: List<KtParameterSymbol>
|
||||
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtFunctionLikeSymbol>
|
||||
@@ -26,18 +26,23 @@ abstract class KtFunctionSymbol : KtFunctionLikeSymbol(),
|
||||
KtNamedSymbol,
|
||||
KtPossibleExtensionSymbol,
|
||||
KtSymbolWithTypeParameters,
|
||||
KtSymbolWithModality<KtCommonSymbolModality> {
|
||||
KtSymbolWithModality<KtCommonSymbolModality>,
|
||||
KtSymbolWithVisibility,
|
||||
KtAnnotatedSymbol {
|
||||
abstract val callableIdIfNonLocal: FqName?
|
||||
|
||||
abstract val isSuspend: Boolean
|
||||
abstract val isOperator: Boolean
|
||||
abstract val isExternal: Boolean
|
||||
abstract val isInline: Boolean
|
||||
abstract val isOverride: Boolean
|
||||
|
||||
abstract override val valueParameters: List<KtFunctionParameterSymbol>
|
||||
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtFunctionSymbol>
|
||||
}
|
||||
|
||||
abstract class KtConstructorSymbol : KtFunctionLikeSymbol() {
|
||||
abstract class KtConstructorSymbol : KtFunctionLikeSymbol(), KtAnnotatedSymbol, KtSymbolWithVisibility {
|
||||
abstract val isPrimary: Boolean
|
||||
abstract val containingClassIdIfNonLocal: ClassId?
|
||||
|
||||
|
||||
+8
-5
@@ -5,14 +5,17 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtCommonSymbolModality
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithModality
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtTypedSymbol
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.*
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
|
||||
|
||||
sealed class KtPropertyAccessorSymbol : KtSymbol,
|
||||
KtSymbolWithModality<KtCommonSymbolModality> {
|
||||
sealed class KtPropertyAccessorSymbol : KtCallableSymbol(),
|
||||
KtSymbolWithModality<KtCommonSymbolModality>,
|
||||
KtSymbolWithVisibility {
|
||||
abstract val isDefault: Boolean
|
||||
abstract val isInline: Boolean
|
||||
abstract val isOverride: Boolean
|
||||
|
||||
abstract val symbolKind: KtSymbolKind
|
||||
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtPropertyAccessorSymbol>
|
||||
}
|
||||
|
||||
+19
-5
@@ -27,7 +27,11 @@ sealed class KtVariableSymbol : KtVariableLikeSymbol() {
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtVariableSymbol>
|
||||
}
|
||||
|
||||
abstract class KtJavaFieldSymbol : KtVariableSymbol(), KtSymbolWithModality<KtCommonSymbolModality>, KtSymbolWithKind {
|
||||
abstract class KtJavaFieldSymbol :
|
||||
KtVariableSymbol(),
|
||||
KtSymbolWithModality<KtCommonSymbolModality>,
|
||||
KtSymbolWithVisibility,
|
||||
KtSymbolWithKind {
|
||||
final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER
|
||||
|
||||
abstract val callableIdIfNonLocal: FqName?
|
||||
@@ -35,14 +39,24 @@ abstract class KtJavaFieldSymbol : KtVariableSymbol(), KtSymbolWithModality<KtCo
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtJavaFieldSymbol>
|
||||
}
|
||||
|
||||
// TODO getters & setters
|
||||
abstract class KtPropertySymbol : KtVariableSymbol(),
|
||||
KtPossibleExtensionSymbol,
|
||||
KtSymbolWithModality<KtCommonSymbolModality>,
|
||||
KtSymbolWithVisibility,
|
||||
KtAnnotatedSymbol,
|
||||
KtSymbolWithKind {
|
||||
|
||||
abstract val callableIdIfNonLocal: FqName?
|
||||
|
||||
abstract val getter: KtPropertyGetterSymbol?
|
||||
abstract val setter: KtPropertySetterSymbol?
|
||||
|
||||
abstract val hasBackingField: Boolean
|
||||
|
||||
abstract val isConst: Boolean
|
||||
|
||||
abstract val isOverride: Boolean
|
||||
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtPropertySymbol>
|
||||
}
|
||||
|
||||
@@ -50,15 +64,15 @@ abstract class KtLocalVariableSymbol : KtVariableSymbol(), KtSymbolWithKind {
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtLocalVariableSymbol>
|
||||
}
|
||||
|
||||
sealed class KtParameterSymbol : KtVariableLikeSymbol(), KtSymbolWithKind {
|
||||
sealed class KtParameterSymbol : KtVariableLikeSymbol(), KtSymbolWithKind, KtAnnotatedSymbol {
|
||||
abstract val hasDefaultValue: Boolean
|
||||
|
||||
abstract val isVararg: Boolean
|
||||
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtParameterSymbol>
|
||||
}
|
||||
|
||||
abstract class KtFunctionParameterSymbol : KtParameterSymbol() {
|
||||
abstract val isVararg: Boolean
|
||||
|
||||
final override val symbolKind: KtSymbolKind get() = KtSymbolKind.NON_PROPERTY_PARAMETER
|
||||
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtFunctionParameterSymbol>
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.frontend.api.symbols.markers
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.psi.KtCallElement
|
||||
|
||||
abstract class KtAnnotationCall {
|
||||
abstract val classId: ClassId?
|
||||
abstract val useSiteTarget: AnnotationUseSiteTarget?
|
||||
abstract val psi: KtCallElement?
|
||||
abstract val arguments: List<KtNamedConstantValue>
|
||||
}
|
||||
|
||||
sealed class KtConstantValue
|
||||
object KtUnsupportedConstantValue : KtConstantValue()
|
||||
|
||||
data class KtSimpleConstantValue<T>(val constant: T) : KtConstantValue()
|
||||
data class KtNamedConstantValue(val name: String, val expression: KtConstantValue)
|
||||
|
||||
interface KtAnnotatedSymbol : KtSymbol {
|
||||
val annotations: List<KtAnnotationCall>
|
||||
}
|
||||
+1
-1
@@ -17,4 +17,4 @@ sealed class KtCommonSymbolModality : KtSymbolModality() {
|
||||
object FINAL : KtCommonSymbolModality()
|
||||
object ABSTRACT : KtCommonSymbolModality()
|
||||
object OPEN : KtCommonSymbolModality()
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.frontend.api.symbols.markers
|
||||
|
||||
interface KtSymbolWithVisibility {
|
||||
val visibility: KtSymbolVisibility
|
||||
}
|
||||
|
||||
sealed class KtSymbolVisibility {
|
||||
object PUBLIC : KtSymbolVisibility()
|
||||
object PRIVATE : KtSymbolVisibility()
|
||||
object PROTECTED : KtSymbolVisibility()
|
||||
object INTERNAL : KtSymbolVisibility()
|
||||
object UNKNOWN : KtSymbolVisibility()
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.frontend.api.types
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtTypeArgument
|
||||
import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassLikeSymbol
|
||||
|
||||
Reference in New Issue
Block a user