Minor, remove unused functions from inlineCodegenUtils.kt
This commit is contained in:
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.codegen.ASSERTIONS_DISABLED_FIELD_NAME
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.BaseExpressionCodegen
|
||||
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
|
||||
import org.jetbrains.kotlin.codegen.SamWrapperCodegen.SAM_WRAPPER_SUFFIX
|
||||
import org.jetbrains.kotlin.codegen.`when`.WhenByEnumsMapping
|
||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
|
||||
@@ -23,22 +22,19 @@ import org.jetbrains.kotlin.codegen.intrinsics.classId
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.intConstant
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryPackageSourceElement
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
|
||||
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder
|
||||
import org.jetbrains.kotlin.load.kotlin.VirtualFileKotlinClass
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.types.TypeProjectionImpl
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
@@ -531,42 +527,6 @@ fun isFakeLocalVariableForInline(name: String): Boolean {
|
||||
|
||||
internal fun isThis0(name: String): Boolean = AsmUtil.CAPTURED_THIS_FIELD == name
|
||||
|
||||
val FunctionDescriptor.sourceFilePath: String
|
||||
get() {
|
||||
val source = source as PsiSourceElement
|
||||
val containingFile = source.psi?.containingFile
|
||||
return containingFile?.virtualFile?.canonicalPath!!
|
||||
}
|
||||
|
||||
fun FunctionDescriptor.getClassFilePath(typeMapper: KotlinTypeMapper, cache: IncrementalCache): String {
|
||||
val container = containingDeclaration as? DeclarationDescriptorWithSource
|
||||
val source = container?.source
|
||||
|
||||
return when (source) {
|
||||
is KotlinJvmBinaryPackageSourceElement -> {
|
||||
val directMember = JvmCodegenUtil.getDirectMember(this) as? DeserializedCallableMemberDescriptor
|
||||
?: throw AssertionError("Expected DeserializedCallableMemberDescriptor, got: $this")
|
||||
val kotlinClass =
|
||||
source.getContainingBinaryClass(directMember) ?: throw AssertionError("Descriptor $this is not found, in: $source")
|
||||
if (kotlinClass !is VirtualFileKotlinClass) {
|
||||
throw AssertionError("Expected VirtualFileKotlinClass, got $kotlinClass")
|
||||
}
|
||||
kotlinClass.file.canonicalPath!!
|
||||
}
|
||||
is KotlinJvmBinarySourceElement -> {
|
||||
val directMember = JvmCodegenUtil.getDirectMember(this)
|
||||
assert(directMember is DeserializedCallableMemberDescriptor) { "Expected DeserializedSimpleFunctionDescriptor, got: $this" }
|
||||
val kotlinClass = source.binaryClass as VirtualFileKotlinClass
|
||||
kotlinClass.file.canonicalPath!!
|
||||
}
|
||||
else -> {
|
||||
val implementationOwnerType = typeMapper.mapImplementationOwner(this)
|
||||
val className = implementationOwnerType.internalName
|
||||
cache.getClassFilePath(className)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class InlineOnlySmapSkipper(codegen: BaseExpressionCodegen) {
|
||||
|
||||
private val callLineNumber = codegen.lastLineNumber
|
||||
|
||||
Reference in New Issue
Block a user