FIR LC: mangle internal function names
This commit is contained in:
committed by
Ilya Kirillov
parent
c79601e616
commit
1fe574f406
+1
-1
@@ -45,7 +45,7 @@ internal class FirLightAccessorMethodForSymbol(
|
||||
val defaultName = containingPropertySymbol.name.identifier.let {
|
||||
if (containingClass.isAnnotationType) it else it.abiName()
|
||||
}
|
||||
containingPropertySymbol.computeJvmMethodName(defaultName, accessorSite)
|
||||
containingPropertySymbol.computeJvmMethodName(defaultName, containingClass, accessorSite)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-9
@@ -20,6 +20,10 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtAnnotatedSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithVisibility
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtSourceModule
|
||||
import org.jetbrains.kotlin.analysis.project.structure.getKtModule
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.ifTrue
|
||||
|
||||
internal abstract class FirLightMethod(
|
||||
@@ -68,7 +72,7 @@ internal abstract class FirLightMethod(
|
||||
}
|
||||
}
|
||||
|
||||
override val isMangled: Boolean = false
|
||||
override val isMangled: Boolean = false // TODO: checkIsMangled ?
|
||||
|
||||
abstract override fun getTypeParameters(): Array<PsiTypeParameter>
|
||||
abstract override fun hasTypeParameters(): Boolean
|
||||
@@ -81,6 +85,7 @@ internal abstract class FirLightMethod(
|
||||
|
||||
protected fun <T> T.computeJvmMethodName(
|
||||
defaultName: String,
|
||||
containingClass: FirLightClassBase,
|
||||
annotationUseSiteTarget: AnnotationUseSiteTarget? = null
|
||||
): String where T : KtAnnotatedSymbol, T : KtSymbolWithVisibility, T : KtCallableSymbol {
|
||||
getJvmNameFromAnnotation(annotationUseSiteTarget)?.let { return it }
|
||||
@@ -90,14 +95,10 @@ internal abstract class FirLightMethod(
|
||||
} ?: this.visibility
|
||||
|
||||
if (effectiveVisibilityIfNotInternal != Visibilities.Internal) return defaultName
|
||||
if (containingClass is KtLightClassForFacade) return defaultName
|
||||
if (hasPublishedApiAnnotation(annotationUseSiteTarget)) return defaultName
|
||||
|
||||
//TODO
|
||||
// val moduleName = module?.name ?: return defaultName
|
||||
|
||||
return defaultName
|
||||
|
||||
// if (hasPublishedApiAnnotation(annotationUseSiteTarget)) return defaultName
|
||||
//
|
||||
// return KotlinTypeMapper.InternalNameMapper.mangleInternalName(defaultName, moduleName)
|
||||
val moduleName = (getKtModule(project) as? KtSourceModule)?.moduleName ?: return defaultName
|
||||
return KotlinTypeMapper.InternalNameMapper.mangleInternalName(defaultName, moduleName)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -34,7 +34,7 @@ internal class FirLightSimpleMethodForSymbol(
|
||||
) {
|
||||
|
||||
private val _name: String by lazyPub {
|
||||
functionSymbol.computeJvmMethodName(functionSymbol.name.asString())
|
||||
functionSymbol.computeJvmMethodName(functionSymbol.name.asString(), containingClass)
|
||||
}
|
||||
|
||||
override fun getName(): String = _name
|
||||
|
||||
Reference in New Issue
Block a user