diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-12 04:23:51 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-12 04:23:51 +0400 |
commit | a6000809a34735ffe1c40bf07a9e291d3c767eb9 (patch) | |
tree | 9d32fe971859e8cd36cb302be204fcdccefe886d /src/Analysis/AnalysisEnvironment.kt | |
parent | a83488aae453f1bf01cfb5507317acf0b9ddfb82 (diff) | |
download | dokka-a6000809a34735ffe1c40bf07a9e291d3c767eb9.tar.gz dokka-a6000809a34735ffe1c40bf07a9e291d3c767eb9.tar.bz2 dokka-a6000809a34735ffe1c40bf07a9e291d3c767eb9.zip |
Store descriptors instead of resolution scopes, rename Model -> Module
Diffstat (limited to 'src/Analysis/AnalysisEnvironment.kt')
-rw-r--r-- | src/Analysis/AnalysisEnvironment.kt | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Analysis/AnalysisEnvironment.kt b/src/Analysis/AnalysisEnvironment.kt index 346367ee..20c1a764 100644 --- a/src/Analysis/AnalysisEnvironment.kt +++ b/src/Analysis/AnalysisEnvironment.kt @@ -10,6 +10,7 @@ import org.jetbrains.jet.config.* import org.jetbrains.jet.cli.common.* import org.jetbrains.jet.cli.jvm.* import com.intellij.openapi.util.* +import org.jetbrains.jet.lang.descriptors.ModuleDescriptor public class AnalysisEnvironment(val messageCollector: MessageCollector, body: AnalysisEnvironment.() -> Unit = {}) : Disposable { val configuration = CompilerConfiguration(); @@ -19,30 +20,36 @@ public class AnalysisEnvironment(val messageCollector: MessageCollector, body: A body() } - private fun withContext<T>(processor: (JetCoreEnvironment, BindingContext) -> T): T { + private fun withContext<T>(processor: (JetCoreEnvironment, ModuleDescriptor, BindingContext) -> T): T { val environment = JetCoreEnvironment.createForProduction(this, configuration) - val result = environment.analyze(messageCollector) - return processor(environment, result) + val exhaust = environment.analyze(messageCollector) + return processor(environment, exhaust.getModuleDescriptor(), exhaust.getBindingContext()) } public fun withContext<T>(processor: (BindingContext) -> T): T { - return withContext { environment, context -> processor(context) } + return withContext { environment, module, context -> processor(context) } } public fun streamFiles<T>(processor: (BindingContext, JetFile) -> T): Stream<T> { - return withContext { environment, context -> + return withContext { environment, module, context -> environment.getSourceFiles().stream().map { file -> processor(context, file) } } } public fun processFiles<T>(processor: (BindingContext, JetFile) -> T): List<T> { - return withContext { environment, context -> + return withContext { environment, module, context -> environment.getSourceFiles().map { file -> processor(context, file) } } } + public fun processFiles<T>(processor: (BindingContext, ModuleDescriptor, JetFile) -> T): List<T> { + return withContext { environment, module, context -> + environment.getSourceFiles().map { file -> processor(context, module, file) } + } + } + public fun processFilesFlat<T>(processor: (BindingContext, JetFile) -> List<T>): List<T> { - return withContext { environment, context -> + return withContext { environment, module, context -> environment.getSourceFiles().flatMap { file -> processor(context, file) } } } |