[LL API] Remove extra 'Project' parameter
This commit is contained in:
+6
-10
@@ -45,7 +45,6 @@ import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
@OptIn(PrivateSessionConstructor::class, SessionConfiguration::class)
|
||||
internal object LLFirSessionFactory {
|
||||
fun createSourcesSession(
|
||||
project: Project,
|
||||
module: KtSourceModule,
|
||||
globalResolveComponents: LLFirGlobalResolveComponents,
|
||||
sessionsCache: MutableMap<KtModule, LLFirSession>
|
||||
@@ -53,6 +52,7 @@ internal object LLFirSessionFactory {
|
||||
sessionsCache[module]?.let { return it as LLFirSourcesSession }
|
||||
checkCanceled()
|
||||
|
||||
val project = module.project
|
||||
val platform = module.platform
|
||||
val builtinsSession = LLFirBuiltinsSessionFactory.getInstance(project).getBuiltinsSession(platform)
|
||||
val languageVersionSettings = wrapLanguageVersionSettings(module.languageVersionSettings)
|
||||
@@ -136,7 +136,6 @@ internal object LLFirSessionFactory {
|
||||
|
||||
|
||||
fun createLibraryOrLibrarySourceResolvableSession(
|
||||
project: Project,
|
||||
module: KtModule,
|
||||
globalComponents: LLFirGlobalResolveComponents,
|
||||
builtinSession: LLFirBuiltinsAndCloneableSession,
|
||||
@@ -147,6 +146,8 @@ internal object LLFirSessionFactory {
|
||||
sessionsCache[module]?.let { return it as LLFirLibraryOrLibrarySourceResolvableModuleSession }
|
||||
checkCanceled()
|
||||
|
||||
val project = module.project
|
||||
|
||||
val libraryModule = when (module) {
|
||||
is KtLibraryModule -> module
|
||||
is KtLibrarySourceModule -> module.binaryLibrary
|
||||
@@ -231,13 +232,13 @@ internal object LLFirSessionFactory {
|
||||
}
|
||||
|
||||
fun createScriptSession(
|
||||
project: Project,
|
||||
module: KtScriptModule,
|
||||
sessionsCache: MutableMap<KtModule, LLFirSession>
|
||||
): LLFirScriptSession {
|
||||
sessionsCache[module]?.let { return it as LLFirScriptSession }
|
||||
checkCanceled()
|
||||
|
||||
val project = module.project
|
||||
val platform = module.platform
|
||||
val builtinsSession = LLFirBuiltinsSessionFactory.getInstance(project).getBuiltinsSession(platform)
|
||||
val languageVersionSettings = wrapLanguageVersionSettings(module.languageVersionSettings)
|
||||
@@ -309,13 +310,13 @@ internal object LLFirSessionFactory {
|
||||
}
|
||||
|
||||
fun createNotUnderContentRootResolvableSession(
|
||||
project: Project,
|
||||
module: KtNotUnderContentRootModule,
|
||||
sessionsCache: MutableMap<KtModule, LLFirSession>
|
||||
): LLFirNonUnderContentRootResolvableModuleSession {
|
||||
sessionsCache[module]?.let { return it as LLFirNonUnderContentRootResolvableModuleSession }
|
||||
checkCanceled()
|
||||
|
||||
val project = module.project
|
||||
val builtinsSession = LLFirBuiltinsSessionFactory.getInstance(project).getBuiltinsSession(JvmPlatforms.unspecifiedJvmPlatform)
|
||||
val languageVersionSettings = LanguageVersionSettingsImpl.DEFAULT
|
||||
val scopeProvider = FirKotlinScopeProvider(::wrapScopeWithJvmMapped)
|
||||
@@ -412,12 +413,7 @@ internal object LLFirSessionFactory {
|
||||
}
|
||||
|
||||
is KtSourceModule -> {
|
||||
createSourcesSession(
|
||||
project,
|
||||
dependency,
|
||||
globalResolveComponents,
|
||||
sessionsCache
|
||||
)
|
||||
createSourcesSession(dependency, globalResolveComponents, sessionsCache)
|
||||
}
|
||||
|
||||
is KtScriptModule,
|
||||
|
||||
+2
-13
@@ -44,12 +44,7 @@ class LLFirSessionProviderStorage(val project: Project) {
|
||||
private fun createSessionProviderForSourceSession(useSiteKtModule: KtSourceModule): LLFirSessionProvider {
|
||||
val (sessions, session) = sourceAsUseSiteSessionCache.withMappings { mappings ->
|
||||
val sessions = mutableMapOf<KtModule, LLFirSession>().apply { putAll(mappings) }
|
||||
val session = LLFirSessionFactory.createSourcesSession(
|
||||
project,
|
||||
useSiteKtModule,
|
||||
globalComponents,
|
||||
sessions
|
||||
)
|
||||
val session = LLFirSessionFactory.createSourcesSession(useSiteKtModule, globalComponents, sessions)
|
||||
sessions to session
|
||||
}
|
||||
return LLFirSessionProvider(project, session, KtModuleToSessionMappingByWeakValueMapImpl(sessions))
|
||||
@@ -60,7 +55,6 @@ class LLFirSessionProviderStorage(val project: Project) {
|
||||
val (sessions, session) = libraryAsUseSiteSessionCache.withMappings { mappings ->
|
||||
val sessions = mutableMapOf<KtModule, LLFirSession>().apply { putAll(mappings) }
|
||||
val session = LLFirSessionFactory.createLibraryOrLibrarySourceResolvableSession(
|
||||
project,
|
||||
useSiteKtModule,
|
||||
globalComponents,
|
||||
builtInsSessionFactory.getBuiltinsSession(useSiteKtModule.platform),
|
||||
@@ -75,7 +69,6 @@ class LLFirSessionProviderStorage(val project: Project) {
|
||||
val (sessions, session) = sourceAsUseSiteSessionCache.withMappings { mappings ->
|
||||
val sessions = mutableMapOf<KtModule, LLFirSession>().apply { putAll(mappings) }
|
||||
val session = LLFirSessionFactory.createScriptSession(
|
||||
project,
|
||||
useSiteKtModule,
|
||||
sessions
|
||||
)
|
||||
@@ -87,11 +80,7 @@ class LLFirSessionProviderStorage(val project: Project) {
|
||||
private fun createSessionProviderForNotUnderContentRootSession(useSiteKtModule: KtNotUnderContentRootModule): LLFirSessionProvider {
|
||||
val (sessions, session) = notUnderContentRootSessionCache.withMappings { mappings ->
|
||||
val sessions = mutableMapOf<KtModule, LLFirSession>().apply { putAll(mappings) }
|
||||
val session = LLFirSessionFactory.createNotUnderContentRootResolvableSession(
|
||||
project,
|
||||
useSiteKtModule,
|
||||
sessions
|
||||
)
|
||||
val session = LLFirSessionFactory.createNotUnderContentRootResolvableSession(useSiteKtModule, sessions)
|
||||
sessions to session
|
||||
}
|
||||
return LLFirSessionProvider(project, session, KtModuleToSessionMappingByWeakValueMapImpl(sessions))
|
||||
|
||||
Reference in New Issue
Block a user