[AA] KtSymbol: add context receiver to 'createPointer'

^KT-54051
This commit is contained in:
Dmitrii Gridin
2022-11-25 15:23:13 +01:00
committed by Space Team
parent 73372e557e
commit e27ffada26
87 changed files with 452 additions and 217 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.analysis.api.symbols
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.base.KtContextReceiversOwner
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtAnnotatedSymbol
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtPossibleMemberSymbol
@@ -20,6 +21,7 @@ public sealed class KtCallableSymbol : KtSymbolWithKind, KtPossibleMemberSymbol,
public abstract val receiverParameter: KtReceiverParameterSymbol?
public abstract val isExtension: Boolean
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtCallableSymbol>
}
@@ -39,5 +41,6 @@ public abstract class KtReceiverParameterSymbol : KtAnnotatedSymbol {
*/
public abstract val owningCallableSymbol: KtCallableSymbol
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtReceiverParameterSymbol>
}
@@ -1,10 +1,11 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 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.analysis.api.symbols
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.base.KtContextReceiversOwner
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.symbols.markers.*
@@ -21,6 +22,7 @@ public val KtClassifierSymbol.nameOrAnonymous: Name
get() = name ?: SpecialNames.ANONYMOUS
public abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbol {
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtTypeParameterSymbol>
final override val typeParameters: List<KtTypeParameterSymbol>
@@ -34,6 +36,7 @@ public abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbo
public sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtSymbolWithKind, KtPossibleMemberSymbol {
public abstract val classIdIfNonLocal: ClassId?
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtClassLikeSymbol>
}
@@ -47,6 +50,7 @@ public abstract class KtTypeAliasSymbol : KtClassLikeSymbol(),
*/
public abstract val expandedType: KtType
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtTypeAliasSymbol>
}
@@ -55,6 +59,7 @@ public sealed class KtClassOrObjectSymbol : KtClassLikeSymbol(), KtSymbolWithMem
public abstract val classKind: KtClassKind
public abstract val superTypes: List<KtType>
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtClassOrObjectSymbol>
}
@@ -67,6 +72,7 @@ public abstract class KtAnonymousObjectSymbol : KtClassOrObjectSymbol() {
final override val typeParameters: List<KtTypeParameterSymbol>
get() = withValidityAssertion { emptyList() }
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtAnonymousObjectSymbol>
}
@@ -85,6 +91,7 @@ public abstract class KtNamedClassOrObjectSymbol : KtClassOrObjectSymbol(),
public abstract val companionObject: KtNamedClassOrObjectSymbol?
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtNamedClassOrObjectSymbol>
}
@@ -1,13 +1,15 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 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.analysis.api.symbols
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtAnnotatedSymbol
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
public abstract class KtFileSymbol : KtAnnotatedSymbol {
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtFileSymbol>
}
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.analysis.api.symbols
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.base.KtContextReceiver
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.symbols.markers.*
@@ -22,6 +23,7 @@ public sealed class KtFunctionLikeSymbol : KtCallableSymbol(), KtSymbolWithKind
*/
public abstract val hasStableParameterNames: Boolean
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtFunctionLikeSymbol>
}
@@ -32,12 +34,14 @@ public abstract class KtAnonymousFunctionSymbol : KtFunctionLikeSymbol() {
final override val typeParameters: List<KtTypeParameterSymbol>
get() = withValidityAssertion { emptyList() }
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtAnonymousFunctionSymbol>
}
public abstract class KtSamConstructorSymbol : KtFunctionLikeSymbol(), KtNamedSymbol {
final override val symbolKind: KtSymbolKind get() = withValidityAssertion { KtSymbolKind.SAM_CONSTRUCTOR }
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtSamConstructorSymbol>
}
@@ -60,6 +64,7 @@ public abstract class KtFunctionSymbol : KtFunctionLikeSymbol(),
*/
public abstract val isBuiltinFunctionInvoke: Boolean
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtFunctionSymbol>
}
@@ -76,5 +81,6 @@ public abstract class KtConstructorSymbol : KtFunctionLikeSymbol(),
final override val receiverParameter: KtReceiverParameterSymbol? get() = withValidityAssertion { null }
final override val contextReceivers: List<KtContextReceiver> get() = withValidityAssertion { emptyList() }
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtConstructorSymbol>
}
@@ -1,15 +1,17 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 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.analysis.api.symbols
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
import org.jetbrains.kotlin.name.FqName
public abstract class KtPackageSymbol : KtSymbol {
public abstract val fqName: FqName
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtPackageSymbol>
}
@@ -1,10 +1,11 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 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.analysis.api.symbols
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.base.KtContextReceiver
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.symbols.markers.*
@@ -30,15 +31,18 @@ public sealed class KtPropertyAccessorSymbol : KtFunctionLikeSymbol(),
final override val symbolKind: KtSymbolKind get() = withValidityAssertion { KtSymbolKind.ACCESSOR }
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtPropertyAccessorSymbol>
}
public abstract class KtPropertyGetterSymbol : KtPropertyAccessorSymbol() {
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtPropertyGetterSymbol>
}
public abstract class KtPropertySetterSymbol : KtPropertyAccessorSymbol() {
public abstract val parameter: KtValueParameterSymbol
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtPropertySetterSymbol>
}
@@ -1,11 +1,12 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 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.analysis.api.symbols
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeOwner
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
@@ -21,6 +22,7 @@ public interface KtSymbol : KtLifetimeOwner {
*/
public val psi: PsiElement?
context(KtAnalysisSession)
public fun createPointer(): KtSymbolPointer<KtSymbol>
}
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.analysis.api.symbols
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.KtConstantInitializerValue
import org.jetbrains.kotlin.analysis.api.KtInitializerValue
import org.jetbrains.kotlin.analysis.api.KtNonConstantInitializerValue
@@ -20,6 +21,7 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtExpression
public sealed class KtVariableLikeSymbol : KtCallableSymbol(), KtNamedSymbol, KtSymbolWithKind, KtPossibleMemberSymbol {
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtVariableLikeSymbol>
}
@@ -49,6 +51,7 @@ public abstract class KtBackingFieldSymbol : KtVariableLikeSymbol() {
final override val typeParameters: List<KtTypeParameterSymbol>
get() = withValidityAssertion { emptyList() }
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtVariableLikeSymbol>
public companion object {
@@ -69,12 +72,15 @@ public abstract class KtEnumEntrySymbol : KtVariableLikeSymbol(), KtSymbolWithMe
//todo reduntant, remove
public abstract val containingEnumClassIdIfNonLocal: ClassId?
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtEnumEntrySymbol>
}
public sealed class KtVariableSymbol : KtVariableLikeSymbol() {
public abstract val isVal: Boolean
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtVariableSymbol>
}
@@ -93,6 +99,7 @@ public abstract class KtJavaFieldSymbol :
public abstract val isStatic: Boolean
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtJavaFieldSymbol>
}
@@ -126,6 +133,7 @@ public sealed class KtPropertySymbol : KtVariableSymbol(),
*/
public abstract val initializer: KtInitializerValue?
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtPropertySymbol>
}
@@ -134,6 +142,7 @@ public abstract class KtKotlinPropertySymbol : KtPropertySymbol() {
public abstract val isConst: Boolean
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtKotlinPropertySymbol>
}
@@ -150,6 +159,7 @@ public abstract class KtSyntheticJavaPropertySymbol : KtPropertySymbol() {
public abstract val javaGetterSymbol: KtFunctionSymbol
public abstract val javaSetterSymbol: KtFunctionSymbol?
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtSyntheticJavaPropertySymbol>
}
@@ -162,6 +172,7 @@ public abstract class KtLocalVariableSymbol : KtVariableSymbol(), KtSymbolWithKi
final override val typeParameters: List<KtTypeParameterSymbol>
get() = withValidityAssertion { emptyList() }
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtLocalVariableSymbol>
}
@@ -200,6 +211,7 @@ public abstract class KtValueParameterSymbol : KtVariableLikeSymbol(), KtSymbolW
*/
public abstract val isImplicitLambdaParameter: Boolean
context(KtAnalysisSession)
abstract override fun createPointer(): KtSymbolPointer<KtValueParameterSymbol>
/**