[Commonizer] Drop CirProperty interface for plain data class
This commit is contained in:
committed by
Space
parent
f0feca286e
commit
906346b7d9
@@ -9,87 +9,27 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
|
||||||
interface CirProperty : CirFunctionOrProperty, CirLiftedUpDeclaration {
|
data class CirProperty(
|
||||||
val isExternal: Boolean
|
|
||||||
val isVar: Boolean
|
|
||||||
val isLateInit: Boolean
|
|
||||||
val isConst: Boolean
|
|
||||||
val isDelegate: Boolean
|
|
||||||
val getter: CirPropertyGetter?
|
|
||||||
val setter: CirPropertySetter?
|
|
||||||
val backingFieldAnnotations: List<CirAnnotation>
|
|
||||||
val delegateFieldAnnotations: List<CirAnnotation>
|
|
||||||
val compileTimeInitializer: CirConstantValue
|
|
||||||
|
|
||||||
override fun withContainingClass(containingClass: CirContainingClass): CirProperty
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
|
||||||
inline fun create(
|
|
||||||
annotations: List<CirAnnotation>,
|
|
||||||
name: CirName,
|
|
||||||
typeParameters: List<CirTypeParameter>,
|
|
||||||
visibility: Visibility,
|
|
||||||
modality: Modality,
|
|
||||||
containingClass: CirContainingClass?,
|
|
||||||
isExternal: Boolean,
|
|
||||||
extensionReceiver: CirExtensionReceiver?,
|
|
||||||
returnType: CirType,
|
|
||||||
kind: CallableMemberDescriptor.Kind,
|
|
||||||
isVar: Boolean,
|
|
||||||
isLateInit: Boolean,
|
|
||||||
isConst: Boolean,
|
|
||||||
isDelegate: Boolean,
|
|
||||||
getter: CirPropertyGetter?,
|
|
||||||
setter: CirPropertySetter?,
|
|
||||||
backingFieldAnnotations: List<CirAnnotation>,
|
|
||||||
delegateFieldAnnotations: List<CirAnnotation>,
|
|
||||||
compileTimeInitializer: CirConstantValue
|
|
||||||
): CirProperty = CirPropertyImpl(
|
|
||||||
annotations = annotations,
|
|
||||||
name = name,
|
|
||||||
typeParameters = typeParameters,
|
|
||||||
visibility = visibility,
|
|
||||||
modality = modality,
|
|
||||||
containingClass = containingClass,
|
|
||||||
isExternal = isExternal,
|
|
||||||
extensionReceiver = extensionReceiver,
|
|
||||||
returnType = returnType,
|
|
||||||
kind = kind,
|
|
||||||
isVar = isVar,
|
|
||||||
isLateInit = isLateInit,
|
|
||||||
isConst = isConst,
|
|
||||||
isDelegate = isDelegate,
|
|
||||||
getter = getter,
|
|
||||||
setter = setter,
|
|
||||||
backingFieldAnnotations = backingFieldAnnotations,
|
|
||||||
delegateFieldAnnotations = delegateFieldAnnotations,
|
|
||||||
compileTimeInitializer = compileTimeInitializer
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class CirPropertyImpl(
|
|
||||||
override val annotations: List<CirAnnotation>,
|
override val annotations: List<CirAnnotation>,
|
||||||
override val name: CirName,
|
override val name: CirName,
|
||||||
override val typeParameters: List<CirTypeParameter>,
|
override val typeParameters: List<CirTypeParameter>,
|
||||||
override val visibility: Visibility,
|
override val visibility: Visibility,
|
||||||
override val modality: Modality,
|
override val modality: Modality,
|
||||||
override val containingClass: CirContainingClass?,
|
override val containingClass: CirContainingClass?,
|
||||||
override val isExternal: Boolean,
|
val isExternal: Boolean,
|
||||||
override val extensionReceiver: CirExtensionReceiver?,
|
override val extensionReceiver: CirExtensionReceiver?,
|
||||||
override val returnType: CirType,
|
override val returnType: CirType,
|
||||||
override val kind: CallableMemberDescriptor.Kind,
|
override val kind: CallableMemberDescriptor.Kind,
|
||||||
override val isVar: Boolean,
|
val isVar: Boolean,
|
||||||
override val isLateInit: Boolean,
|
val isLateInit: Boolean,
|
||||||
override val isConst: Boolean,
|
val isConst: Boolean,
|
||||||
override val isDelegate: Boolean,
|
val isDelegate: Boolean,
|
||||||
override val getter: CirPropertyGetter?,
|
val getter: CirPropertyGetter?,
|
||||||
override val setter: CirPropertySetter?,
|
val setter: CirPropertySetter?,
|
||||||
override val backingFieldAnnotations: List<CirAnnotation>,
|
val backingFieldAnnotations: List<CirAnnotation>,
|
||||||
override val delegateFieldAnnotations: List<CirAnnotation>,
|
val delegateFieldAnnotations: List<CirAnnotation>,
|
||||||
override val compileTimeInitializer: CirConstantValue
|
val compileTimeInitializer: CirConstantValue
|
||||||
) : CirProperty {
|
) : CirFunctionOrProperty, CirLiftedUpDeclaration {
|
||||||
// const property in "common" fragment is already lifted up
|
// const property in "common" fragment is already lifted up
|
||||||
override val isLiftedUp get() = isConst
|
override val isLiftedUp get() = isConst
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class PropertyCommonizer(classifiers: CirKnownClassifiers) : AbstractFunctionOrP
|
|||||||
val constCommonizationState = constCommonizationState
|
val constCommonizationState = constCommonizationState
|
||||||
val constCompileTimeInitializer = (constCommonizationState as? ConstSameValue)?.compileTimeInitializer
|
val constCompileTimeInitializer = (constCommonizationState as? ConstSameValue)?.compileTimeInitializer
|
||||||
|
|
||||||
return CirProperty.create(
|
return CirProperty(
|
||||||
annotations = emptyList(),
|
annotations = emptyList(),
|
||||||
name = name,
|
name = name,
|
||||||
typeParameters = typeParameters.result,
|
typeParameters = typeParameters.result,
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ object CirDeserializers {
|
|||||||
)
|
)
|
||||||
} else CirConstantValue.NullValue
|
} else CirConstantValue.NullValue
|
||||||
|
|
||||||
return CirProperty.create(
|
return CirProperty(
|
||||||
annotations = annotations(source.flags, typeResolver, source::annotations),
|
annotations = annotations(source.flags, typeResolver, source::annotations),
|
||||||
name = name,
|
name = name,
|
||||||
typeParameters = source.typeParameters.compactMap { typeParameter(it, typeResolver) },
|
typeParameters = source.typeParameters.compactMap { typeParameter(it, typeResolver) },
|
||||||
|
|||||||
Reference in New Issue
Block a user