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