[analysis] introduce KtBuiltinsModule and remove hacks related to the stdlib module search

This commit is contained in:
Ilya Kirillov
2022-07-18 23:07:06 +02:00
parent dc4527462f
commit dd00062559
29 changed files with 152 additions and 187 deletions
@@ -150,6 +150,27 @@ public interface KtLibrarySourceModule : KtModuleWithProject {
get() = "Library sourced of $libraryName"
}
/**
* Module which contains kotlin [builtins](https://kotlinlang.org/spec/built-in-types-and-their-semantics.html) for specific platform
* Kotlin builtins are usually reside in the compiler, so [contentScope] and [getBinaryRoots] are empty
*/
public class KtBuiltinsModule(
override val platform: TargetPlatform,
override val analyzerServices: PlatformDependentAnalyzerServices,
override val project: Project
) : KtBinaryModule {
override val directRegularDependencies: List<KtModule> get() = emptyList()
override val directRefinementDependencies: List<KtModule> get() = emptyList()
override val directFriendDependencies: List<KtModule> get() = emptyList()
override val contentScope: GlobalSearchScope get() = GlobalSearchScope.EMPTY_SCOPE
override fun getBinaryRoots(): Collection<Path> = emptyList()
override val moduleDescription: String get() = "Builtins for $platform"
override fun equals(other: Any?): Boolean = other is KtBuiltinsModule && this.platform == other.platform
override fun hashCode(): Int = platform.hashCode()
}
/**
* A set of sources which lives outside project content root. E.g, testdata files or source files of some other project.
*/
@@ -20,8 +20,6 @@ public abstract class ProjectStructureProvider {
*/
// TODO: We rather need a session or facade that maintains this information.
public abstract fun getKtBinaryModules(): Collection<KtBinaryModule>
public abstract fun getStdlibWithBuiltinsModule(platform: TargetPlatform): KtLibraryModule?
}
/**