JVM_IR: mark origins of capture fields in suspend lambdas

This commit is contained in:
pyos
2020-02-20 12:33:25 +01:00
committed by Ilmir Usmanov
parent 6b98ea2378
commit c5ffbfd33c
6 changed files with 22 additions and 13 deletions
@@ -178,7 +178,18 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
addField("p\$", it.type)
}
val parametersFields = info.function.valueParameters.map { addField(it.name, it.type) }
val parametersFields = info.function.valueParameters.map {
addField {
name = it.name
type = it.type
origin = if (it.isCrossinline)
LocalDeclarationsLowering.DECLARATION_ORIGIN_FIELD_FOR_CROSSINLINE_CAPTURED_VALUE
else
LocalDeclarationsLowering.DECLARATION_ORIGIN_FIELD_FOR_CAPTURED_VALUE
isFinal = true
visibility = JavaVisibilities.PACKAGE_VISIBILITY
}
}
val parametersWithoutArguments = parametersFields.withIndex()
.mapNotNull { (i, field) -> if (info.reference.getValueArgument(i) == null) field else null }
val parametersWithArguments = parametersFields.withIndex()