[Commonizer] Make CirProperty.[backing|delegate]FieldAnnotations non-nullable

There is effectively no difference between missing field and a field with no annotations.
This commit is contained in:
Dmitriy Dolovov
2021-02-19 23:31:40 +03:00
parent 215dd8515b
commit b3e68d3704
4 changed files with 10 additions and 10 deletions
@@ -13,7 +13,7 @@ interface CirProperty : CirFunctionOrProperty, CirLiftedUpDeclaration {
val isDelegate: Boolean val isDelegate: Boolean
val getter: CirPropertyGetter? val getter: CirPropertyGetter?
val setter: CirPropertySetter? val setter: CirPropertySetter?
val backingFieldAnnotations: List<CirAnnotation>? // null assumes no backing field val backingFieldAnnotations: List<CirAnnotation>
val delegateFieldAnnotations: List<CirAnnotation>? // null assumes no backing field val delegateFieldAnnotations: List<CirAnnotation>
val compileTimeInitializer: CirConstantValue<*>? val compileTimeInitializer: CirConstantValue<*>?
} }
@@ -39,8 +39,8 @@ object CirPropertyFactory {
isDelegate = source.isDelegated, isDelegate = source.isDelegated,
getter = source.getter?.let(CirPropertyGetterFactory::create), getter = source.getter?.let(CirPropertyGetterFactory::create),
setter = source.setter?.let(CirPropertySetterFactory::create), setter = source.setter?.let(CirPropertySetterFactory::create),
backingFieldAnnotations = source.backingField?.annotations?.compactMap(CirAnnotationFactory::create), backingFieldAnnotations = source.backingField?.annotations?.compactMap(CirAnnotationFactory::create).orEmpty(),
delegateFieldAnnotations = source.delegateField?.annotations?.compactMap(CirAnnotationFactory::create), delegateFieldAnnotations = source.delegateField?.annotations?.compactMap(CirAnnotationFactory::create).orEmpty(),
compileTimeInitializer = compileTimeInitializer compileTimeInitializer = compileTimeInitializer
) )
} }
@@ -63,8 +63,8 @@ object CirPropertyFactory {
isDelegate: Boolean, isDelegate: Boolean,
getter: CirPropertyGetter?, getter: CirPropertyGetter?,
setter: CirPropertySetter?, setter: CirPropertySetter?,
backingFieldAnnotations: List<CirAnnotation>?, backingFieldAnnotations: List<CirAnnotation>,
delegateFieldAnnotations: List<CirAnnotation>?, delegateFieldAnnotations: List<CirAnnotation>,
compileTimeInitializer: CirConstantValue<*>? compileTimeInitializer: CirConstantValue<*>?
): CirProperty { ): CirProperty {
return CirPropertyImpl( return CirPropertyImpl(
@@ -27,8 +27,8 @@ data class CirPropertyImpl(
override val isDelegate: Boolean, override val isDelegate: Boolean,
override val getter: CirPropertyGetter?, override val getter: CirPropertyGetter?,
override val setter: CirPropertySetter?, override val setter: CirPropertySetter?,
override val backingFieldAnnotations: List<CirAnnotation>?, override val backingFieldAnnotations: List<CirAnnotation>,
override val delegateFieldAnnotations: List<CirAnnotation>?, override val delegateFieldAnnotations: List<CirAnnotation>,
override val compileTimeInitializer: CirConstantValue<*>? override val compileTimeInitializer: CirConstantValue<*>?
) : CirProperty { ) : CirProperty {
// const property in "common" fragment is already lifted up // const property in "common" fragment is already lifted up
@@ -45,8 +45,8 @@ class PropertyCommonizer(classifiers: CirKnownClassifiers) : AbstractFunctionOrP
isDelegate = false, isDelegate = false,
getter = CirPropertyGetterFactory.DEFAULT_NO_ANNOTATIONS, getter = CirPropertyGetterFactory.DEFAULT_NO_ANNOTATIONS,
setter = setter, setter = setter,
backingFieldAnnotations = null, backingFieldAnnotations = emptyList(),
delegateFieldAnnotations = null, delegateFieldAnnotations = emptyList(),
compileTimeInitializer = constCompileTimeInitializer compileTimeInitializer = constCompileTimeInitializer
) )
} }