aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 21:14:42 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 21:14:42 +0400
commit0b2e3467bb6ae3d6df935063f0bc9579cd392c98 (patch)
treee9f70113acb887a8646c2d71ad5881127a807bdf /src
parent68d3bc8d76e550f98cf768362eb311d0cc4f3a0d (diff)
downloaddokka-0b2e3467bb6ae3d6df935063f0bc9579cd392c98.tar.gz
dokka-0b2e3467bb6ae3d6df935063f0bc9579cd392c98.tar.bz2
dokka-0b2e3467bb6ae3d6df935063f0bc9579cd392c98.zip
Add documentation
Diffstat (limited to 'src')
-rw-r--r--src/Analysis/AnalysisEnvironment.kt50
1 files changed, 46 insertions, 4 deletions
diff --git a/src/Analysis/AnalysisEnvironment.kt b/src/Analysis/AnalysisEnvironment.kt
index 9fe90628..a6cb6f28 100644
--- a/src/Analysis/AnalysisEnvironment.kt
+++ b/src/Analysis/AnalysisEnvironment.kt
@@ -36,51 +36,93 @@ public class AnalysisEnvironment(val messageCollector: MessageCollector, body: A
return processor(environment, exhaust.getModuleDescriptor(), exhaust.getBindingContext())
}
+ /**
+ * Executes [processor] when analysis is complete.
+ * $processor is a function to receive compiler module and context for symbol resolution
+ */
public fun withContext<T>(processor: (ModuleDescriptor, BindingContext) -> T): T {
return withContext { environment, module, context -> processor(module, context) }
}
+ /**
+ * Streams files into [processor] and returns a stream of its results
+ * $processor is a function to receive context for symbol resolution and file for processing
+ */
public fun streamFiles<T>(processor: (BindingContext, JetFile) -> T): Stream<T> {
return withContext { environment, module, context ->
environment.getSourceFiles().stream().map { file -> processor(context, file) }
}
}
+ /**
+ * Runs [processor] for each file and collects its results into single list
+ * $processor is a function to receive context for symbol resolution and file for processing
+ */
public fun processFiles<T>(processor: (BindingContext, JetFile) -> T): List<T> {
return withContext { environment, module, context ->
environment.getSourceFiles().map { file -> processor(context, file) }
}
}
+ /**
+ * Runs [processor] for each file and collects its results into single list
+ * $processor is a function to receive context for symbol resolution, module and file for processing
+ */
public fun processFiles<T>(processor: (BindingContext, ModuleDescriptor, JetFile) -> T): List<T> {
return withContext { environment, module, context ->
environment.getSourceFiles().map { file -> processor(context, module, file) }
}
}
+ /**
+ * Runs [processor] for each file and collects its results into single list
+ * $processor is a function to receive context for symbol resolution and file for processing
+ */
public fun processFilesFlat<T>(processor: (BindingContext, JetFile) -> List<T>): List<T> {
return withContext { environment, module, context ->
environment.getSourceFiles().flatMap { file -> processor(context, file) }
}
}
+ /**
+ * Classpath for this environment.
+ */
public val classpath: List<File>
get() = configuration.get(JVMConfigurationKeys.CLASSPATH_KEY) ?: listOf()
- public fun addClasspath(list: List<File>) {
- configuration.addAll(JVMConfigurationKeys.CLASSPATH_KEY, list)
+ /**
+ * Adds list of paths to classpath.
+ * $paths collection of paths to add
+ */
+ public fun addClasspath(paths: List<File>) {
+ configuration.addAll(JVMConfigurationKeys.CLASSPATH_KEY, paths)
}
- public fun addClasspath(file: File) {
- configuration.add(JVMConfigurationKeys.CLASSPATH_KEY, file)
+ /**
+ * Adds path to classpath.
+ * $path path to add
+ */
+ public fun addClasspath(path: File) {
+ configuration.add(JVMConfigurationKeys.CLASSPATH_KEY, path)
}
+ /**
+ * List of source roots for this environment.
+ */
public val sources: List<String>
get() = configuration.get(CommonConfigurationKeys.SOURCE_ROOTS_KEY) ?: listOf()
+
+ /**
+ * Adds list of paths to source roots.
+ * $list collection of files to add
+ */
public fun addSources(list: List<String>) {
configuration.addAll(CommonConfigurationKeys.SOURCE_ROOTS_KEY, list)
}
+ /**
+ * Disposes the environment and frees all associated resources.
+ */
public override fun dispose() {
Disposer.dispose(this)
}