FIR: add pointer from primary constructor param to correspondng property

This commit is contained in:
Tianyu Geng
2021-10-19 11:18:39 -07:00
committed by Roman Golyshev
parent 112f365414
commit 9b3add0130
18 changed files with 31 additions and 19 deletions
@@ -123,3 +123,10 @@ private object MatchingParameterFunctionTypeKey : FirDeclarationDataKey()
*/
var <D : FirAnonymousFunction>
D.matchingParameterFunctionType: ConeKotlinType? by FirDeclarationDataRegistry.data(MatchingParameterFunctionTypeKey)
private object CorrespondingProperty : FirDeclarationDataKey()
/**
* The corresponding [FirProperty] if the current value parameter is a `val` or `var` declared inside the primary constructor.
*/
var FirValueParameter.correspondingProperty: FirProperty? by FirDeclarationDataRegistry.data(CorrespondingProperty)
@@ -437,6 +437,7 @@ open class FirRenderer(builder: StringBuilder, protected val mode: RenderMode =
private fun Any.renderAsDeclarationAttributeValue() = when (this) {
is FirCallableSymbol<*> -> callableId.toString()
is FirClassLikeSymbol<*> -> classId.asString()
is FirProperty -> symbol.callableId.toString()
else -> toString()
}