[ObjCExport] Analysis Api: Ensure KDocs being exported by providing ObjCExportStubOrigin

^KT-64888 Fixed


Co-authored-by: Sebastian Sellmair <Sebastian.sellmair@jetbrains.com>


Merge-request: KT-MR-13854
Merged-by: Eugene Levenetc <Eugene.Levenetc@jetbrains.com>
This commit is contained in:
Sebastian Sellmair
2024-01-14 01:13:58 +00:00
committed by Space Team
parent a8914acb68
commit a713d66b7b
6 changed files with 19 additions and 20 deletions
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportStubOrigin
import org.jetbrains.kotlin.objcexport.analysisApiUtils.getKDocString
context(KtAnalysisSession)
fun KtSymbol.getObjCStubOrigin(): ObjCExportStubOrigin {
fun KtSymbol.getObjCExportStubOrigin(): ObjCExportStubOrigin {
// TODO: Differentiate origins
// TODO: Extract kdoc from deserialized symbols
return ObjCExportStubOrigin.Source(
@@ -25,7 +25,7 @@ fun KtClassOrObjectSymbol.translateToObjCClass(): ObjCClass? {
val name = getObjCClassOrProtocolName()
val comment: ObjCComment? = annotationsList.translateToObjCComment()
val origin: ObjCExportStubOrigin = getObjCStubOrigin()
val origin: ObjCExportStubOrigin = getObjCExportStubOrigin()
val superProtocols: List<String> = superProtocols()
val members: List<ObjCExportStub> = members().flatMap { it.translateToObjCExportStubs() }
val categoryName: String? = null
@@ -15,13 +15,13 @@ fun KtConstructorSymbol.translateToObjCConstructors(): List<ObjCMethod> {
result.add(
ObjCMethod(
null,
null,
false,
ObjCInstanceType,
listOf("new"),
emptyList(),
listOf(
comment = null,
origin = getObjCExportStubOrigin(),
isInstanceMethod = false,
returnType = ObjCInstanceType,
selectors = listOf("new"),
parameters = emptyList(),
attributes = listOf(
"availability(swift, unavailable, message=\"use object initializers instead\")"
)
)
@@ -48,7 +48,6 @@ internal fun KtFunctionLikeSymbol.buildObjCMethod(
unavailable: Boolean = false,
): ObjCMethod {
val bridge = getMethodBridge()
val origin: ObjCExportStubOrigin? = null
val returnType: ObjCType = mapReturnType(bridge.returnBridge)
val parameters = translateToObjCParameters(bridge)
val selector = getSelector(bridge)
@@ -82,7 +81,7 @@ internal fun KtFunctionLikeSymbol.buildObjCMethod(
return ObjCMethod(
comment = comment,
origin = origin,
origin = getObjCExportStubOrigin(),
isInstanceMethod = bridge.isInstance || isConstructor,
returnType = returnType,
selectors = selectors,
@@ -54,13 +54,13 @@ fun KtPropertySymbol.buildProperty(): ObjCProperty {
//declarationAttributes.addIfNotNull(mapper.getDeprecation(property)?.toDeprecationAttribute())
return ObjCProperty(
name,
null,
null,
type!!,
attributes,
setterName,
getterName,
declarationAttributes
name = name,
comment = null,
origin = getObjCExportStubOrigin(),
type = type!!,
propertyAttributes = attributes,
setterName = setterName,
getterName = getterName,
declarationAttributes = declarationAttributes
)
}
@@ -33,7 +33,7 @@ fun KtClassOrObjectSymbol.translateToObjCProtocol(): ObjCProtocol? {
return ObjCProtocolImpl(
name = name.objCName,
comment = comment,
origin = getObjCStubOrigin(),
origin = getObjCExportStubOrigin(),
attributes = name.toNameAttributes(),
superProtocols = superProtocols(),
members = members