[FIR] make FirPropertyAccessor#propertySymbol non-nullable

we need it to restore property accessor by property

^KT-54311
This commit is contained in:
Dmitrii Gridin
2022-10-05 14:06:23 +02:00
committed by Space Team
parent c6bbce986d
commit a0b814a1b6
15 changed files with 32 additions and 28 deletions
@@ -42,7 +42,7 @@ abstract class FirPropertyAccessor : FirFunction(), FirContractDescriptionOwner,
abstract override val body: FirBlock?
abstract override val contractDescription: FirContractDescription
abstract override val symbol: FirPropertyAccessorSymbol
abstract val propertySymbol: FirPropertySymbol?
abstract val propertySymbol: FirPropertySymbol
abstract val isGetter: Boolean
abstract val isSetter: Boolean
abstract override val annotations: List<FirAnnotation>
@@ -60,7 +60,7 @@ class FirPropertyAccessorBuilder : FirFunctionBuilder, FirAnnotationContainerBui
override var body: FirBlock? = null
var contractDescription: FirContractDescription = FirEmptyContractDescription
lateinit var symbol: FirPropertyAccessorSymbol
var propertySymbol: FirPropertySymbol? = null
lateinit var propertySymbol: FirPropertySymbol
var isGetter: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
override val annotations: MutableList<FirAnnotation> = mutableListOf()
val typeParameters: MutableList<FirTypeParameter> = mutableListOf()
@@ -53,7 +53,7 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor(
override var body: FirBlock?,
override var contractDescription: FirContractDescription,
override val symbol: FirPropertyAccessorSymbol,
override val propertySymbol: FirPropertySymbol?,
override val propertySymbol: FirPropertySymbol,
override val isGetter: Boolean,
override val annotations: MutableList<FirAnnotation>,
override val typeParameters: MutableList<FirTypeParameter>,
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 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.
*/
@@ -64,7 +64,7 @@ abstract class FirDefaultPropertyAccessor(
typeParameters = mutableListOf(),
) {
override val dispatchReceiverType: ConeSimpleKotlinType?
get() = propertySymbol?.dispatchReceiverType
get() = propertySymbol.dispatchReceiverType
final override var body: FirBlock?
get() = null
@@ -1,5 +1,5 @@
/*
* 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.
*/
@@ -24,7 +24,8 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.Deserializ
class FirSyntheticPropertyAccessor(
val delegate: FirSimpleFunction,
override val isGetter: Boolean
override val isGetter: Boolean,
override val propertySymbol: FirPropertySymbol,
) : FirPropertyAccessor() {
override val source: KtSourceElement?
get() = delegate.source
@@ -78,9 +79,6 @@ class FirSyntheticPropertyAccessor(
override val contextReceivers: List<FirContextReceiver>
get() = emptyList()
// NB: unused
override val propertySymbol: FirPropertySymbol? = null
override val controlFlowGraphReference: FirControlFlowGraphReference? = null
override val contractDescription: FirContractDescription = FirEmptyContractDescription
@@ -1,5 +1,5 @@
/*
* 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.
*/
@@ -27,8 +27,8 @@ class FirSyntheticPropertyBuilder {
moduleData, name, isVar = delegateSetter != null, symbol = symbol,
status = status ?: delegateGetter.status,
resolvePhase = delegateGetter.resolvePhase,
getter = FirSyntheticPropertyAccessor(delegateGetter, isGetter = true),
setter = delegateSetter?.let { FirSyntheticPropertyAccessor(it, isGetter = false) },
getter = FirSyntheticPropertyAccessor(delegateGetter, isGetter = true, symbol),
setter = delegateSetter?.let { FirSyntheticPropertyAccessor(it, isGetter = false, symbol) },
deprecationsProvider = deprecationsProvider
)
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 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.
*/
@@ -337,7 +337,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
propertyAccessor.configure {
+symbol("FirPropertyAccessorSymbol")
+field("propertySymbol", firPropertySymbolType, nullable = true).apply {
+field("propertySymbol", firPropertySymbolType).apply {
withBindThis = false
}
+booleanField("isGetter")