Load definitions of symbols from .kotlin_metadata files

Extract AbstractDeserializedPackageFragmentProvider out of
JvmBuiltInsPackageFragmentProvider and implement it a little bit differently in
MetadataPackageFragmentProvider. The main difference is in how the package
fragment scope is constructed: for built-ins, it's just a single scope that
loads everything from one protobuf message. For metadata, package scope can
consist of many files, some of which store information about classes and others
are similar to package parts on JVM, so a ChainedMemberScope instance is
created.

Introduce a bunch of interfaces/methods to deliver the needed behavior to the
'deserialization' module which is not JVM-specific and does not depend on the
compiler code: MetadataFinderFactory,
PackagePartProvider#findMetadataPackageParts, KotlinMetadataFinder#findMetadata.
Note that these declarations are currently only implemented in the compiler; no
metadata package parts/fragments will be found in IDE or reflection
This commit is contained in:
Alexander Udalov
2016-11-16 11:47:05 +03:00
parent 32792c5ce4
commit bfb7b21472
21 changed files with 320 additions and 57 deletions
@@ -20,7 +20,7 @@ import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
interface JvmVirtualFileFinderFactory : VirtualFileFinderFactory {
interface JvmVirtualFileFinderFactory : VirtualFileFinderFactory, MetadataFinderFactory {
override fun create(scope: GlobalSearchScope): JvmVirtualFileFinder
object SERVICE {
@@ -39,6 +39,9 @@ internal class IncrementalPackagePartProvider private constructor(
parent.findPackageParts(packageFqName)).distinct()
}
// TODO
override fun findMetadataPackageParts(packageFqName: String): List<String> = TODO()
companion object {
@JvmStatic
fun create(