Load built-ins from module dependencies in JVM compiler
Introduce a new method KotlinClassFinder#findBuiltInsData, which is only implemented correctly in the JvmCliVirtualFileFinder because it's only used in the compiler code at the moment. Introduce JvmBuiltInsPackageFragmentProvider, the purpose of which is to look for .kotlin_builtins files in the classpath and provide definitions of built-ins from those files. Also exclude script.runtime from compilation because, as other excluded modules, it has no dependency on the stdlib and is no longer compilable from the IDE now, because it cannot resolve built-ins from anywhere
This commit is contained in:
+4
@@ -39,6 +39,7 @@ import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfigu
|
||||
import org.jetbrains.kotlin.serialization.deserialization.NotFoundClasses
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPackageMemberScope
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||
import java.io.InputStream
|
||||
|
||||
fun DeserializerForClassfileDecompiler(classFile: VirtualFile): DeserializerForClassfileDecompiler {
|
||||
val kotlinClassHeaderInfo = IDEKotlinBinaryClassCache.getKotlinBinaryClassHeaderData(classFile)
|
||||
@@ -114,6 +115,9 @@ class DirectoryBasedClassFinder(
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// TODO: load built-ins from packageDirectory?
|
||||
override fun findBuiltInsData(packageFqName: FqName): InputStream? = null
|
||||
}
|
||||
|
||||
class DirectoryBasedDataFinder(
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.load.kotlin.JvmVirtualFileFinder
|
||||
import org.jetbrains.kotlin.load.kotlin.VirtualFileKotlinClassFinder
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
import java.io.InputStream
|
||||
|
||||
private fun checkScopeForFinder(scope: GlobalSearchScope, logger: Logger) {
|
||||
if (scope != GlobalSearchScope.EMPTY_SCOPE && scope.project == null) {
|
||||
@@ -56,6 +56,8 @@ class JsIDEVirtualFileFinder(private val scope: GlobalSearchScope) : JsVirtualFi
|
||||
}
|
||||
|
||||
class JvmIDEVirtualFileFinder(private val scope: GlobalSearchScope) : VirtualFileKotlinClassFinder(), JvmVirtualFileFinder {
|
||||
// TODO: load built-ins metadata from scope
|
||||
override fun findBuiltInsData(packageFqName: FqName): InputStream? = null
|
||||
|
||||
init { checkScopeForFinder(scope, LOG) }
|
||||
|
||||
@@ -66,4 +68,3 @@ class JvmIDEVirtualFileFinder(private val scope: GlobalSearchScope) : VirtualFil
|
||||
private val LOG = Logger.getInstance(JvmIDEVirtualFileFinder::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user