Extract local delegated properties

This commit is contained in:
Tamas Vajk
2022-03-08 15:39:34 +01:00
committed by Ian Lynagh
parent 48b99cf55c
commit f8343b8cc7
5 changed files with 346 additions and 2 deletions

View File

@@ -891,8 +891,28 @@ open class KotlinFileExtractor(
}
}
is IrLocalDelegatedProperty -> {
// TODO:
logger.errorElement("Unhandled IrLocalDelegatedProperty", s)
val blockId = tw.getFreshIdLabel<DbBlock>()
val locId = tw.getLocation(s)
tw.writeStmts_block(blockId, parent, idx, callable)
tw.writeHasLocation(blockId, locId)
extractVariable(s.delegate, callable, blockId, 0)
val propType = useType(s.type)
val propId = tw.getFreshIdLabel<DbKt_local_delegated_property>()
tw.writeKtLocalDelegatedProperties(propId, useVariable(s.delegate), propType.javaResult.id, s.name.asString())
tw.writeKtLocalDelegatedPropertiesKotlinType(propId, propType.kotlinResult.id)
// Getter:
extractStatement(s.getter, callable, blockId, 1)
val l = getLocallyVisibleFunctionLabels(s.getter).function
tw.writeKtLocalDelegatedPropertyGetters(propId, l)
val setter = s.setter
if (setter != null) {
extractStatement(setter, callable, blockId, 2)
val l = getLocallyVisibleFunctionLabels(setter).function
tw.writeKtLocalDelegatedPropertySetters(propId, l)
}
}
else -> {
logger.errorElement("Unrecognised IrStatement: " + s.javaClass, s)