FIR: carry annotations on delegated property accessors

This commit is contained in:
Jinseong Jeon
2020-09-28 00:25:18 -07:00
committed by Mikhail Glukhikh
parent f1aa75fdf8
commit 01d852c006
2 changed files with 8 additions and 1 deletions
@@ -372,6 +372,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate(
delegate = delegateBuilder.build()
if (stubMode) return
if (getter == null || getter is FirDefaultPropertyAccessor) {
val annotations = getter?.annotations
val returnTarget = FirFunctionTarget(null, isLambda = false)
getter = buildPropertyAccessor {
this.session = session
@@ -395,11 +396,15 @@ fun FirPropertyBuilder.generateAccessorsByDelegate(
target = returnTarget
}
)
if (annotations != null) {
this.annotations.addAll(annotations)
}
}.also {
returnTarget.bind(it)
}
}
if (isVar && (setter == null || setter is FirDefaultPropertyAccessor)) {
val annotations = setter?.annotations
setter = buildPropertyAccessor {
this.session = session
origin = FirDeclarationOrigin.Source
@@ -436,6 +441,9 @@ fun FirPropertyBuilder.generateAccessorsByDelegate(
}
}
)
if (annotations != null) {
this.annotations.addAll(annotations)
}
}
}
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME