Adjust extraction to reuse KtProperty* relations

This commit is contained in:
Tamas Vajk
2022-03-09 17:25:11 +01:00
committed by Ian Lynagh
parent 78b4c9403d
commit 0ba2daf31a
2 changed files with 9 additions and 26 deletions

View File

@@ -897,21 +897,21 @@ open class KotlinFileExtractor(
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)
val propId = tw.getFreshIdLabel<DbKt_property>()
tw.writeKtProperties(propId, s.name.asString())
tw.writeHasLocation(propId, locId)
tw.writeKtPropertyDelegates(propId, useVariable(s.delegate))
// Getter:
extractStatement(s.getter, callable, blockId, 1)
val l = getLocallyVisibleFunctionLabels(s.getter).function
tw.writeKtLocalDelegatedPropertyGetters(propId, l)
tw.writeKtPropertyGetters(propId, l)
val setter = s.setter
if (setter != null) {
extractStatement(setter, callable, blockId, 2)
val l = getLocallyVisibleFunctionLabels(setter).function
tw.writeKtLocalDelegatedPropertySetters(propId, l)
tw.writeKtPropertySetters(propId, l)
}
}
else -> {

View File

@@ -1218,24 +1218,7 @@ ktInitializerAssignment(
unique int id: @assignexpr ref
)
ktLocalDelegatedProperties(
unique int id: @kt_local_delegated_property,
unique int variableId: @variable ref,
int typeId: @type ref,
string name: string ref
)
ktLocalDelegatedPropertiesKotlinType(
unique int id: @kt_local_delegated_property ref,
int kttypeid: @kt_type ref
);
ktLocalDelegatedPropertyGetters(
unique int id: @kt_local_delegated_property ref,
int getter: @method ref
)
ktLocalDelegatedPropertySetters(
unique int id: @kt_local_delegated_property ref,
int setter: @method ref
ktPropertyDelegates(
unique int id: @kt_property ref,
unique int variableId: @variable ref
)