-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
163 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...r/src/org/jetbrains/kotlin/analysis/low/level/api/fir/sessions/LLFirWasmSessionFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.kotlin.analysis.low.level.api.fir.sessions | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.search.GlobalSearchScope | ||
import org.jetbrains.kotlin.analysis.low.level.api.fir.projectStructure.LLLibrarySymbolProviderFactory | ||
import org.jetbrains.kotlin.analysis.low.level.api.fir.projectStructure.LLFirModuleData | ||
import org.jetbrains.kotlin.analysis.low.level.api.fir.providers.LLFirModuleWithDependenciesSymbolProvider | ||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaDanglingFileModule | ||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaLibraryModule | ||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule | ||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaSourceModule | ||
import org.jetbrains.kotlin.fir.BuiltinTypes | ||
import org.jetbrains.kotlin.fir.SessionConfiguration | ||
import org.jetbrains.kotlin.fir.deserialization.SingleModuleDataProvider | ||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider | ||
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider | ||
|
||
@OptIn(SessionConfiguration::class) | ||
internal class LLFirWasmSessionFactory(project: Project) : LLFirAbstractSessionFactory(project) { | ||
override fun createSourcesSession(module: KaSourceModule): LLFirSourcesSession { | ||
return doCreateSourcesSession(module) { context -> | ||
register( | ||
FirSymbolProvider::class, | ||
LLFirModuleWithDependenciesSymbolProvider( | ||
this, | ||
providers = listOfNotNull( | ||
context.firProvider.symbolProvider, | ||
context.switchableExtensionDeclarationsSymbolProvider, | ||
context.syntheticFunctionInterfaceProvider, | ||
), | ||
context.dependencyProvider, | ||
) | ||
) | ||
} | ||
} | ||
|
||
override fun createLibrarySession(module: KaModule): LLFirLibraryOrLibrarySourceResolvableModuleSession { | ||
return doCreateLibrarySession(module) { context -> | ||
register( | ||
FirSymbolProvider::class, | ||
LLFirModuleWithDependenciesSymbolProvider( | ||
this, | ||
providers = listOf( | ||
context.firProvider.symbolProvider, | ||
), | ||
context.dependencyProvider, | ||
) | ||
) | ||
} | ||
} | ||
|
||
override fun createBinaryLibrarySession(module: KaLibraryModule): LLFirLibrarySession { | ||
return doCreateBinaryLibrarySession(module) { | ||
} | ||
} | ||
|
||
override fun createDanglingFileSession(module: KaDanglingFileModule, contextSession: LLFirSession): LLFirSession { | ||
return doCreateDanglingFileSession(module, contextSession) { | ||
register( | ||
FirSymbolProvider::class, | ||
LLFirModuleWithDependenciesSymbolProvider( | ||
this, | ||
providers = listOfNotNull( | ||
firProvider.symbolProvider, | ||
switchableExtensionDeclarationsSymbolProvider, | ||
syntheticFunctionInterfaceProvider, | ||
), | ||
dependencyProvider, | ||
) | ||
) | ||
} | ||
} | ||
|
||
override fun createProjectLibraryProvidersForScope( | ||
session: LLFirSession, | ||
moduleData: LLFirModuleData, | ||
kotlinScopeProvider: FirKotlinScopeProvider, | ||
project: Project, | ||
builtinTypes: BuiltinTypes, | ||
scope: GlobalSearchScope, | ||
isFallbackDependenciesProvider: Boolean, | ||
): List<FirSymbolProvider> { | ||
val moduleDataProvider = SingleModuleDataProvider(moduleData) | ||
return LLLibrarySymbolProviderFactory.fromSettings(project).createWasmLibrarySymbolProvider( | ||
session, | ||
moduleData, | ||
kotlinScopeProvider, | ||
moduleDataProvider, | ||
scope, | ||
isFallbackDependenciesProvider, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters