Search in sources :

Example 6 with DeserializedCallableMemberDescriptor

use of org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor in project kotlin by JetBrains.

the class KotlinTypeMapper method getPartSimpleNameForMangling.

@Nullable
private String getPartSimpleNameForMangling(@NotNull CallableMemberDescriptor descriptor) {
    KtFile containingFile = DescriptorToSourceUtils.getContainingFile(descriptor);
    if (containingFile != null) {
        JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(containingFile);
        if (fileClassInfo.getWithJvmMultifileClass()) {
            return fileClassInfo.getFileClassFqName().shortName().asString();
        }
        return null;
    }
    descriptor = DescriptorUtils.getDirectMember(descriptor);
    assert descriptor instanceof DeserializedCallableMemberDescriptor : "Descriptor without sources should be instance of DeserializedCallableMemberDescriptor, but: " + descriptor;
    ContainingClassesInfo containingClassesInfo = getContainingClassesForDeserializedCallable((DeserializedCallableMemberDescriptor) descriptor);
    String facadeShortName = containingClassesInfo.getFacadeClassId().getShortClassName().asString();
    String implShortName = containingClassesInfo.getImplClassId().getShortClassName().asString();
    return !facadeShortName.equals(implShortName) ? implShortName : null;
}
Also used : JvmFileClassInfo(org.jetbrains.kotlin.fileClasses.JvmFileClassInfo) DeserializedCallableMemberDescriptor(org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor) KtFile(org.jetbrains.kotlin.psi.KtFile) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DeserializedCallableMemberDescriptor (org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor)6 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 JavaCallableMemberDescriptor (org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor)2 KtFile (org.jetbrains.kotlin.psi.KtFile)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 IOException (java.io.IOException)1 RootContext (org.jetbrains.kotlin.codegen.context.RootContext)1 GenerationState (org.jetbrains.kotlin.codegen.state.GenerationState)1 KotlinTypeMapper (org.jetbrains.kotlin.codegen.state.KotlinTypeMapper)1 JvmFileClassInfo (org.jetbrains.kotlin.fileClasses.JvmFileClassInfo)1 IrBuiltinsPackageFragmentDescriptor (org.jetbrains.kotlin.ir.descriptors.IrBuiltinsPackageFragmentDescriptor)1 JvmBytecodeBinaryVersion (org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion)1 LazyJavaPackageFragment (org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaPackageFragment)1 ClassId (org.jetbrains.kotlin.name.ClassId)1 DeserializedClassDescriptor (org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor)1 KotlinType (org.jetbrains.kotlin.types.KotlinType)1 Method (org.jetbrains.org.objectweb.asm.commons.Method)1 MethodNode (org.jetbrains.org.objectweb.asm.tree.MethodNode)1