From 8f24c0a3a6dec1b63cad1b68ebfec2b528b6b87f Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Wed, 16 Jul 2014 00:09:46 +0400 Subject: Use alternative way to get exhaust. --- src/Analysis/CompilerAPI.kt | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/Analysis/CompilerAPI.kt') diff --git a/src/Analysis/CompilerAPI.kt b/src/Analysis/CompilerAPI.kt index d874464f..b729d93f 100644 --- a/src/Analysis/CompilerAPI.kt +++ b/src/Analysis/CompilerAPI.kt @@ -14,7 +14,6 @@ import org.jetbrains.jet.lang.psi.* import org.jetbrains.jet.analyzer.* import org.jetbrains.jet.lang.descriptors.* import org.jetbrains.jet.lang.resolve.scopes.* -import org.jetbrains.jet.lang.resolve.name.* private fun getAnnotationsPath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): MutableList { val annotationsPath = arrayListOf() @@ -28,6 +27,23 @@ private fun getAnnotationsPath(paths: KotlinPaths, arguments: K2JVMCompilerArgum return annotationsPath } +fun JetCoreEnvironment.analyze2(messageCollector: MessageCollector): AnalyzeExhaust { + val project = getProject() + val sourceFiles = getSourceFiles() + val support = CliLightClassGenerationSupport.getInstanceForCli(project)!! + val sharedTrace = support.getTrace() + val sharedModule = support.getModule() + val compilerConfiguration = getConfiguration()!! + val exhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(project, sourceFiles, sharedTrace, + Predicates.alwaysFalse(), + sharedModule, + compilerConfiguration.get(JVMConfigurationKeys.MODULE_IDS), + compilerConfiguration.get(JVMConfigurationKeys.INCREMENTAL_CACHE_BASE_DIR)) + return exhaust +} + + + fun JetCoreEnvironment.analyze(messageCollector: MessageCollector): AnalyzeExhaust { val project = getProject() val sourceFiles = getSourceFiles() @@ -53,7 +69,7 @@ fun JetCoreEnvironment.analyze(messageCollector: MessageCollector): AnalyzeExhau fun AnalyzerWithCompilerReport.analyzeAndReport(files: List, analyser: () -> AnalyzeExhaust) = analyzeAndReport(analyser, files) -fun BindingContext.getPackageFragment(file: JetFile) : PackageFragmentDescriptor? = get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file) +fun BindingContext.getPackageFragment(file: JetFile): PackageFragmentDescriptor? = get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file) fun DeclarationDescriptor.isUserCode() = when (this) { -- cgit