forked from fwcd/kotlin-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CompilerFixtures.kt
28 lines (26 loc) · 1.14 KB
/
CompilerFixtures.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package org.javacs.kt
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.container.ComponentProvider
import org.jetbrains.kotlin.descriptors.PackagePartProvider
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory
object CompilerFixtures {
@JvmStatic fun createContainer(
project: Project,
files: Collection<KtFile>,
trace: BindingTrace,
configuration: CompilerConfiguration,
packagePartProvider: (GlobalSearchScope) -> PackagePartProvider): ComponentProvider {
return TopDownAnalyzerFacadeForJVM.createContainer(
project,
emptyList(),
trace,
configuration,
packagePartProvider,
{ storageManager, _ -> FileBasedDeclarationProviderFactory(storageManager, files) })
}
}