diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-16 00:09:46 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-16 00:09:46 +0400 |
commit | 8f24c0a3a6dec1b63cad1b68ebfec2b528b6b87f (patch) | |
tree | 7ae7446ff86e08e9011fc203ba2bbcb7d549be0d /src/Analysis | |
parent | aa59acbaf96e961d28e614a2932f100bea766b4f (diff) | |
download | dokka-8f24c0a3a6dec1b63cad1b68ebfec2b528b6b87f.tar.gz dokka-8f24c0a3a6dec1b63cad1b68ebfec2b528b6b87f.tar.bz2 dokka-8f24c0a3a6dec1b63cad1b68ebfec2b528b6b87f.zip |
Use alternative way to get exhaust.
Diffstat (limited to 'src/Analysis')
-rw-r--r-- | src/Analysis/AnalysisEnvironment.kt | 2 | ||||
-rw-r--r-- | src/Analysis/CompilerAPI.kt | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/Analysis/AnalysisEnvironment.kt b/src/Analysis/AnalysisEnvironment.kt index a6cb6f28..3ab5a40e 100644 --- a/src/Analysis/AnalysisEnvironment.kt +++ b/src/Analysis/AnalysisEnvironment.kt @@ -32,7 +32,7 @@ public class AnalysisEnvironment(val messageCollector: MessageCollector, body: A */ public fun withContext<T>(processor: (JetCoreEnvironment, ModuleDescriptor, BindingContext) -> T): T { val environment = JetCoreEnvironment.createForProduction(this, configuration) - val exhaust = environment.analyze(messageCollector) + val exhaust = environment.analyze2(messageCollector) return processor(environment, exhaust.getModuleDescriptor(), exhaust.getBindingContext()) } 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<File> { val annotationsPath = arrayListOf<File>() @@ -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<PsiFile>(), + 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<JetFile>, 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) { |