Add selector to ObjCGetterForKotlinEnumEntry
This helps to drop usages of obsolete "IrDeclaration.descriptor" from ObjCExportCodeGenerator
This commit is contained in:
committed by
Vasily Levchenko
parent
ca2df3cead
commit
ccf8b570ca
+3
-4
@@ -1252,7 +1252,7 @@ private fun ObjCExportCodeGenerator.createTypeAdapter(
|
|||||||
classAdapters += createArrayConstructorAdapter(it.irConstructorSymbol.owner)
|
classAdapters += createArrayConstructorAdapter(it.irConstructorSymbol.owner)
|
||||||
}
|
}
|
||||||
is ObjCGetterForKotlinEnumEntry -> {
|
is ObjCGetterForKotlinEnumEntry -> {
|
||||||
classAdapters += createEnumEntryAdapter(it.irEnumEntrySymbol.owner)
|
classAdapters += createEnumEntryAdapter(it.irEnumEntrySymbol.owner, it.selector)
|
||||||
}
|
}
|
||||||
is ObjCClassMethodForKotlinEnumValues -> {
|
is ObjCClassMethodForKotlinEnumValues -> {
|
||||||
classAdapters += createEnumValuesAdapter(it.valuesFunctionSymbol.owner, it.selector)
|
classAdapters += createEnumValuesAdapter(it.valuesFunctionSymbol.owner, it.selector)
|
||||||
@@ -1480,10 +1480,9 @@ private fun ObjCExportCodeGenerator.createObjectInstanceAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun ObjCExportCodeGenerator.createEnumEntryAdapter(
|
private fun ObjCExportCodeGenerator.createEnumEntryAdapter(
|
||||||
irEnumEntry: IrEnumEntry
|
irEnumEntry: IrEnumEntry,
|
||||||
|
selector: String
|
||||||
): ObjCExportCodeGenerator.ObjCToKotlinMethodAdapter {
|
): ObjCExportCodeGenerator.ObjCToKotlinMethodAdapter {
|
||||||
val selector = namer.getEnumEntrySelector(irEnumEntry.descriptor)
|
|
||||||
|
|
||||||
return generateObjCToKotlinSyntheticGetter(selector) {
|
return generateObjCToKotlinSyntheticGetter(selector) {
|
||||||
initRuntimeIfNeeded() // For instance methods it gets called when allocating.
|
initRuntimeIfNeeded() // For instance methods it gets called when allocating.
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -69,7 +69,7 @@ internal fun ObjCExportedInterface.createCodeSpec(symbolTable: SymbolTable): Obj
|
|||||||
|
|
||||||
if (descriptor.kind == ClassKind.ENUM_CLASS) {
|
if (descriptor.kind == ClassKind.ENUM_CLASS) {
|
||||||
descriptor.enumEntries.mapTo(methods) {
|
descriptor.enumEntries.mapTo(methods) {
|
||||||
ObjCGetterForKotlinEnumEntry(symbolTable.referenceEnumEntry(it))
|
ObjCGetterForKotlinEnumEntry(symbolTable.referenceEnumEntry(it), namer.getEnumEntrySelector(it))
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptor.getEnumValuesFunctionDescriptor()?.let {
|
descriptor.getEnumValuesFunctionDescriptor()?.let {
|
||||||
@@ -109,7 +109,10 @@ internal class ObjCFactoryMethodForKotlinArrayConstructor(
|
|||||||
val irConstructorSymbol: IrConstructorSymbol
|
val irConstructorSymbol: IrConstructorSymbol
|
||||||
) : ObjCMethodSpec()
|
) : ObjCMethodSpec()
|
||||||
|
|
||||||
internal class ObjCGetterForKotlinEnumEntry(val irEnumEntrySymbol: IrEnumEntrySymbol) : ObjCMethodSpec()
|
internal class ObjCGetterForKotlinEnumEntry(
|
||||||
|
val irEnumEntrySymbol: IrEnumEntrySymbol,
|
||||||
|
val selector: String
|
||||||
|
) : ObjCMethodSpec()
|
||||||
|
|
||||||
internal class ObjCClassMethodForKotlinEnumValues(
|
internal class ObjCClassMethodForKotlinEnumValues(
|
||||||
val valuesFunctionSymbol: IrFunctionSymbol,
|
val valuesFunctionSymbol: IrFunctionSymbol,
|
||||||
|
|||||||
Reference in New Issue
Block a user