[Commonizer] Fix property backing/delegate field annotations serialization

This commit is contained in:
Dmitriy Dolovov
2021-01-29 23:29:51 +03:00
parent 3b91d1c5e5
commit 80b95a22a4
2 changed files with 7 additions and 0 deletions
@@ -151,6 +151,7 @@ internal fun CirProperty.buildProperty(
getterFlags = getter?.propertyAccessorFlags(this, this) ?: NO_FLAGS,
setterFlags = setter?.let { setter -> setter.propertyAccessorFlags(setter, this) } ?: NO_FLAGS
).also { property ->
// TODO unclear where to write backing/delegate field annotations, see KT-44625
annotations.mapTo(property.annotations) { it.buildAnnotation() }
getter?.annotations?.mapTo(property.getterAnnotations) { it.buildAnnotation() }
setter?.annotations?.mapTo(property.setterAnnotations) { it.buildAnnotation() }
@@ -104,6 +104,12 @@ internal fun CirTypeAlias.typeAliasFlags(): Flags =
private inline val CirHasAnnotations.hasAnnotationsFlag: Flag?
get() = if (annotations.isNotEmpty()) Flag.Common.HAS_ANNOTATIONS else null
private inline val CirProperty.hasAnnotationsFlag: Flag?
get() = if (annotations.isNotEmpty() || !backingFieldAnnotations.isNullOrEmpty() || !delegateFieldAnnotations.isNullOrEmpty())
Flag.Common.HAS_ANNOTATIONS
else
null
private inline val CirHasVisibility.visibilityFlag: Flag
get() = when (visibility) {
DescriptorVisibilities.PUBLIC -> Flag.Common.IS_PUBLIC