[LL FIR] refactoring, remove repeated logic of registering default components in inheritors of LLFirAbstractSessionFactory
This commit is contained in:
committed by
Space Team
parent
3a90cb00c7
commit
46d5d512e5
+5
@@ -55,6 +55,7 @@ import org.jetbrains.kotlin.utils.exceptions.withPsiEntry
|
||||
import org.jetbrains.kotlin.utils.exceptions.withVirtualFileEntry
|
||||
import kotlin.script.experimental.host.ScriptingHostConfiguration
|
||||
import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
|
||||
import org.jetbrains.kotlin.fir.session.FirSessionFactoryHelper.registerDefaultComponents
|
||||
|
||||
@OptIn(PrivateSessionConstructor::class, SessionConfiguration::class)
|
||||
internal abstract class LLFirAbstractSessionFactory(protected val project: Project) {
|
||||
@@ -201,6 +202,7 @@ internal abstract class LLFirAbstractSessionFactory(protected val project: Proje
|
||||
registerCommonComponentsAfterExtensionsAreConfigured()
|
||||
registerJavaComponents(JavaModuleResolver.getInstance(project))
|
||||
registerResolveComponents()
|
||||
registerDefaultComponents()
|
||||
|
||||
val ktFile = module.file as? KtFile
|
||||
|
||||
@@ -269,6 +271,7 @@ internal abstract class LLFirAbstractSessionFactory(protected val project: Proje
|
||||
registerIdeComponents(project)
|
||||
registerCommonComponents(languageVersionSettings)
|
||||
registerResolveComponents()
|
||||
registerDefaultComponents()
|
||||
|
||||
val firProvider = LLFirProvider(
|
||||
this,
|
||||
@@ -358,6 +361,7 @@ internal abstract class LLFirAbstractSessionFactory(protected val project: Proje
|
||||
registerCommonComponents(languageVersionSettings)
|
||||
registerCommonComponentsAfterExtensionsAreConfigured()
|
||||
registerResolveComponents()
|
||||
registerDefaultComponents()
|
||||
|
||||
val firProvider = LLFirProvider(
|
||||
this,
|
||||
@@ -489,6 +493,7 @@ internal abstract class LLFirAbstractSessionFactory(protected val project: Proje
|
||||
registerIdeComponents(project)
|
||||
registerCommonComponents(languageVersionSettings)
|
||||
registerResolveComponents()
|
||||
registerDefaultComponents()
|
||||
|
||||
val firProvider = LLFirProvider(
|
||||
this,
|
||||
|
||||
-7
@@ -31,8 +31,6 @@ import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
internal class LLFirCommonSessionFactory(project: Project) : LLFirAbstractSessionFactory(project) {
|
||||
override fun createSourcesSession(module: KtSourceModule): LLFirSourcesSession {
|
||||
return doCreateSourcesSession(module) { context ->
|
||||
registerDefaultComponents()
|
||||
|
||||
register(
|
||||
FirSymbolProvider::class,
|
||||
LLFirModuleWithDependenciesSymbolProvider(
|
||||
@@ -50,8 +48,6 @@ internal class LLFirCommonSessionFactory(project: Project) : LLFirAbstractSessio
|
||||
|
||||
override fun createLibrarySession(module: KtModule): LLFirLibraryOrLibrarySourceResolvableModuleSession {
|
||||
return doCreateLibrarySession(module) { context ->
|
||||
registerDefaultComponents()
|
||||
|
||||
register(
|
||||
FirSymbolProvider::class,
|
||||
LLFirModuleWithDependenciesSymbolProvider(
|
||||
@@ -69,15 +65,12 @@ internal class LLFirCommonSessionFactory(project: Project) : LLFirAbstractSessio
|
||||
|
||||
override fun createBinaryLibrarySession(module: KtBinaryModule): LLFirLibrarySession {
|
||||
return doCreateBinaryLibrarySession(module) {
|
||||
registerDefaultComponents()
|
||||
registerPlatformSpecificComponentsIfAny(module)
|
||||
}
|
||||
}
|
||||
|
||||
override fun createDanglingFileSession(module: KtDanglingFileModule, contextSession: LLFirSession): LLFirSession {
|
||||
return doCreateDanglingFileSession(module, contextSession) {
|
||||
registerDefaultComponents()
|
||||
|
||||
register(
|
||||
FirSymbolProvider::class,
|
||||
LLFirModuleWithDependenciesSymbolProvider(
|
||||
|
||||
-5
@@ -20,13 +20,11 @@ import org.jetbrains.kotlin.fir.deserialization.SingleModuleDataProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
|
||||
import org.jetbrains.kotlin.fir.session.FirJsSessionFactory.registerJsComponents
|
||||
import org.jetbrains.kotlin.fir.session.FirSessionFactoryHelper.registerDefaultComponents
|
||||
|
||||
@OptIn(SessionConfiguration::class)
|
||||
internal class LLFirJsSessionFactory(project: Project) : LLFirAbstractSessionFactory(project) {
|
||||
override fun createSourcesSession(module: KtSourceModule): LLFirSourcesSession {
|
||||
return doCreateSourcesSession(module) { context ->
|
||||
registerDefaultComponents()
|
||||
registerJsComponents(moduleKind = null)
|
||||
|
||||
register(
|
||||
@@ -46,7 +44,6 @@ internal class LLFirJsSessionFactory(project: Project) : LLFirAbstractSessionFac
|
||||
|
||||
override fun createLibrarySession(module: KtModule): LLFirLibraryOrLibrarySourceResolvableModuleSession {
|
||||
return doCreateLibrarySession(module) { context ->
|
||||
registerDefaultComponents()
|
||||
registerJsComponents(moduleKind = null)
|
||||
|
||||
register(
|
||||
@@ -64,14 +61,12 @@ internal class LLFirJsSessionFactory(project: Project) : LLFirAbstractSessionFac
|
||||
|
||||
override fun createBinaryLibrarySession(module: KtBinaryModule): LLFirLibrarySession {
|
||||
return doCreateBinaryLibrarySession(module) {
|
||||
registerDefaultComponents()
|
||||
registerJsComponents(moduleKind = null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun createDanglingFileSession(module: KtDanglingFileModule, contextSession: LLFirSession): LLFirSession {
|
||||
return doCreateDanglingFileSession(module, contextSession) {
|
||||
registerDefaultComponents()
|
||||
registerJsComponents(moduleKind = null)
|
||||
|
||||
register(
|
||||
|
||||
-5
@@ -22,14 +22,12 @@ import org.jetbrains.kotlin.fir.java.deserialization.OptionalAnnotationClassesPr
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
|
||||
import org.jetbrains.kotlin.fir.session.FirNativeSessionFactory.registerNativeComponents
|
||||
import org.jetbrains.kotlin.fir.session.FirSessionFactoryHelper.registerDefaultComponents
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
@OptIn(SessionConfiguration::class)
|
||||
internal class LLFirNativeSessionFactory(project: Project) : LLFirAbstractSessionFactory(project) {
|
||||
override fun createSourcesSession(module: KtSourceModule): LLFirSourcesSession {
|
||||
return doCreateSourcesSession(module) { context ->
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
|
||||
register(
|
||||
@@ -49,7 +47,6 @@ internal class LLFirNativeSessionFactory(project: Project) : LLFirAbstractSessio
|
||||
|
||||
override fun createLibrarySession(module: KtModule): LLFirLibraryOrLibrarySourceResolvableModuleSession {
|
||||
return doCreateLibrarySession(module) { context ->
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
register(
|
||||
FirSymbolProvider::class,
|
||||
@@ -66,14 +63,12 @@ internal class LLFirNativeSessionFactory(project: Project) : LLFirAbstractSessio
|
||||
|
||||
override fun createBinaryLibrarySession(module: KtBinaryModule): LLFirLibrarySession {
|
||||
return doCreateBinaryLibrarySession(module) {
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
}
|
||||
}
|
||||
|
||||
override fun createDanglingFileSession(module: KtDanglingFileModule, contextSession: LLFirSession): LLFirSession {
|
||||
return doCreateDanglingFileSession(module, contextSession) {
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
|
||||
register(
|
||||
|
||||
Reference in New Issue
Block a user