aboutsummaryrefslogtreecommitdiff
path: root/src/Analysis
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 19:34:52 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 19:34:52 +0400
commit68d3bc8d76e550f98cf768362eb311d0cc4f3a0d (patch)
tree5ae62771d6392ef81cf996db6b317610739b56fd /src/Analysis
parent1aa62f8071939f1a2b3640e00378cd86b8599b9c (diff)
downloaddokka-68d3bc8d76e550f98cf768362eb311d0cc4f3a0d.tar.gz
dokka-68d3bc8d76e550f98cf768362eb311d0cc4f3a0d.tar.bz2
dokka-68d3bc8d76e550f98cf768362eb311d0cc4f3a0d.zip
Beautification and documentation.
Diffstat (limited to 'src/Analysis')
-rw-r--r--src/Analysis/AnalysisEnvironment.kt10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Analysis/AnalysisEnvironment.kt b/src/Analysis/AnalysisEnvironment.kt
index d657ae4a..9fe90628 100644
--- a/src/Analysis/AnalysisEnvironment.kt
+++ b/src/Analysis/AnalysisEnvironment.kt
@@ -12,6 +12,12 @@ import org.jetbrains.jet.cli.jvm.*
import com.intellij.openapi.util.*
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor
+/**
+ * Kotlin as a service entry point
+ * Configures environment, analyses files and provides facilities to perform code processing without emitting bytecode
+ * $messageCollector is required by compiler infrastructure and will receive all compiler messages
+ * $body is optional and can be used to configure environment without creating local variable
+ */
public class AnalysisEnvironment(val messageCollector: MessageCollector, body: AnalysisEnvironment.() -> Unit = {}) : Disposable {
val configuration = CompilerConfiguration();
@@ -20,6 +26,10 @@ public class AnalysisEnvironment(val messageCollector: MessageCollector, body: A
body()
}
+ /**
+ * Executes [processor] when analysis is complete.
+ * $processor is a function to receive compiler environment, module and context for symbol resolution
+ */
public fun withContext<T>(processor: (JetCoreEnvironment, ModuleDescriptor, BindingContext) -> T): T {
val environment = JetCoreEnvironment.createForProduction(this, configuration)
val exhaust = environment.analyze(messageCollector)