[K/N] Avoid magic strings in KonanMangler
This commit is contained in:
committed by
teamcity
parent
ddfd94b3b2
commit
0fd4f10f6c
+7
-8
@@ -5,10 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.backend.native
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.KotlinExportChecker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.KotlinMangleComputer
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleMode
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.SpecialDeclarationType
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.*
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.backend.FirMangler
|
||||
import org.jetbrains.kotlin.fir.backend.FirExportCheckerVisitor
|
||||
@@ -88,15 +85,17 @@ class FirNativeKotlinMangleComputer(
|
||||
return buildString {
|
||||
receiverParameter?.let {
|
||||
append(it.getTypeName(session))
|
||||
append(".")
|
||||
append(MangleConstant.FQN_SEPARATOR)
|
||||
}
|
||||
|
||||
append("objc:")
|
||||
append(MangleConstant.OBJC_MARK)
|
||||
append(it.selector)
|
||||
if ((this@platformSpecificFunctionName is FirConstructor) && isObjCConstructor(session)) append("#Constructor")
|
||||
if ((this@platformSpecificFunctionName is FirConstructor) && isObjCConstructor(session)) {
|
||||
append(MangleConstant.OBJC_CONSTRUCTOR_MARK)
|
||||
}
|
||||
|
||||
if (this@platformSpecificFunctionName is FirPropertyAccessor) {
|
||||
append("#Accessor")
|
||||
append(MangleConstant.OBJC_PROPERTY_ACCESSOR_MARK)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -47,5 +47,9 @@ enum class MangleConstant(val prefix: Char, val separator: Char, val suffix: Cha
|
||||
const val FUN_PREFIX = "kfun"
|
||||
const val CLASS_PREFIX = "kclass"
|
||||
const val FIELD_PREFIX = "kfield"
|
||||
|
||||
const val OBJC_MARK = "objc:"
|
||||
const val OBJC_CONSTRUCTOR_MARK = "#Constructor"
|
||||
const val OBJC_PROPERTY_ACCESSOR_MARK = "#Accessor"
|
||||
}
|
||||
}
|
||||
+12
-8
@@ -71,15 +71,17 @@ abstract class AbstractKonanIrMangler(
|
||||
return buildString {
|
||||
if (extensionReceiverParameter != null) {
|
||||
append(extensionReceiverParameter!!.type.getClass()!!.name)
|
||||
append(".")
|
||||
append(MangleConstant.FQN_SEPARATOR)
|
||||
}
|
||||
|
||||
append("objc:")
|
||||
append(MangleConstant.OBJC_MARK)
|
||||
append(it.selector)
|
||||
if (this@platformSpecificFunctionName is IrConstructor && this@platformSpecificFunctionName.isObjCConstructor) append("#Constructor")
|
||||
if (this@platformSpecificFunctionName is IrConstructor && this@platformSpecificFunctionName.isObjCConstructor) {
|
||||
append(MangleConstant.OBJC_CONSTRUCTOR_MARK)
|
||||
}
|
||||
|
||||
if ((this@platformSpecificFunctionName as? IrSimpleFunction)?.correspondingPropertySymbol != null) {
|
||||
append("#Accessor")
|
||||
append(MangleConstant.OBJC_PROPERTY_ACCESSOR_MARK)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,15 +138,17 @@ abstract class AbstractKonanDescriptorMangler : DescriptorBasedKotlinManglerImpl
|
||||
return buildString {
|
||||
if (extensionReceiverParameter != null) {
|
||||
append(extensionReceiverParameter!!.type.constructor.declarationDescriptor!!.name)
|
||||
append(".")
|
||||
append(MangleConstant.FQN_SEPARATOR)
|
||||
}
|
||||
|
||||
append("objc:")
|
||||
append(MangleConstant.OBJC_MARK)
|
||||
append(it.selector)
|
||||
if (this@platformSpecificFunctionName is ConstructorDescriptor && this@platformSpecificFunctionName.isObjCConstructor) append("#Constructor")
|
||||
if (this@platformSpecificFunctionName is ConstructorDescriptor && this@platformSpecificFunctionName.isObjCConstructor) {
|
||||
append(MangleConstant.OBJC_CONSTRUCTOR_MARK)
|
||||
}
|
||||
|
||||
if (this@platformSpecificFunctionName is PropertyAccessorDescriptor) {
|
||||
append("#Accessor")
|
||||
append(MangleConstant.OBJC_PROPERTY_ACCESSOR_MARK)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user