Simplify usages of IncrementalPackageFragment and related code
Since its scope is now empty, no descriptor now has a container that is an instance of IncrementalPackageFragment -> a lot of code is not needed anymore
This commit is contained in:
-2
@@ -27,8 +27,6 @@ interface IncrementalCache {
|
||||
|
||||
fun getStableMultifileFacadeParts(facadeInternalName: String): Collection<String>?
|
||||
|
||||
fun getMultifileFacade(partInternalName: String): String?
|
||||
|
||||
fun getPackagePartData(partInternalName: String): JvmPackagePartProto?
|
||||
|
||||
fun getModuleMappingData(): ByteArray?
|
||||
|
||||
+4
-10
@@ -22,7 +22,6 @@ import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaPackageFragment
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||
@@ -40,16 +39,11 @@ interface ModuleVisibilityManager {
|
||||
}
|
||||
}
|
||||
|
||||
val DeclarationDescriptor.isFromIncrementalPackageFragment: Boolean
|
||||
get() =
|
||||
DescriptorUtils.getParentOfType(this, PackageFragmentDescriptor::class.java, false) is IncrementalPackageFragmentProvider.IncrementalPackageFragment
|
||||
|
||||
fun isContainedByCompiledPartOfOurModule(descriptor: DeclarationDescriptor, outDirectory: File?): Boolean {
|
||||
if (outDirectory == null) return false
|
||||
|
||||
val packageFragment = DescriptorUtils.getParentOfType(descriptor, PackageFragmentDescriptor::class.java, false)
|
||||
|
||||
if (packageFragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment) return true
|
||||
|
||||
if (outDirectory == null || packageFragment !is LazyJavaPackageFragment) return false
|
||||
if (packageFragment !is LazyJavaPackageFragment) return false
|
||||
|
||||
val source = getSourceElement(descriptor)
|
||||
|
||||
@@ -87,4 +81,4 @@ fun getSourceElement(descriptor: DeclarationDescriptor): SourceElement =
|
||||
}
|
||||
|
||||
private val DeclarationDescriptor.toSourceElement: SourceElement
|
||||
get() = if (this is DeclarationDescriptorWithSource) source else SourceElement.NO_SOURCE
|
||||
get() = if (this is DeclarationDescriptorWithSource) source else SourceElement.NO_SOURCE
|
||||
|
||||
Reference in New Issue
Block a user