diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-10-03 21:40:21 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-10-03 21:40:21 +0400 |
commit | b642b7c35e63729303094483dc2d176ec5ce7a7d (patch) | |
tree | 224f5d1050b82f5cba3956e78dfe3ad8bccdf426 | |
parent | e93440bd4a520ab81203e8b0105ac43323f67e6b (diff) | |
download | dokka-b642b7c35e63729303094483dc2d176ec5ce7a7d.tar.gz dokka-b642b7c35e63729303094483dc2d176ec5ce7a7d.tar.bz2 dokka-b642b7c35e63729303094483dc2d176ec5ce7a7d.zip |
Fix visibility filtering.
-rw-r--r-- | src/Kotlin/DocumentationBuildingVisitor.kt | 8 | ||||
-rw-r--r-- | src/main.kt | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/Kotlin/DocumentationBuildingVisitor.kt b/src/Kotlin/DocumentationBuildingVisitor.kt index 364c4f6c..81ac2430 100644 --- a/src/Kotlin/DocumentationBuildingVisitor.kt +++ b/src/Kotlin/DocumentationBuildingVisitor.kt @@ -4,13 +4,15 @@ import org.jetbrains.jet.lang.descriptors.* import org.jetbrains.jet.lang.resolve.name.* import org.jetbrains.jet.lang.resolve.* -public data class DocumentationOptions(val includeNonPublic : Boolean = false) +public data class DocumentationOptions(val includeNonPublic: Boolean = false) class DocumentationBuildingVisitor(val context: BindingContext, val options: DocumentationOptions, private val worker: DeclarationDescriptorVisitor<DocumentationNode, DocumentationNode>) : DeclarationDescriptorVisitor<DocumentationNode, DocumentationNode> { + val visibleToDocumentation = setOf(Visibilities.INTERNAL, Visibilities.PROTECTED, Visibilities.PUBLIC) + private fun visitChildren(descriptors: Collection<DeclarationDescriptor>, data: DocumentationNode) { for (descriptor in descriptors) { visitChild(descriptor, data) @@ -19,7 +21,9 @@ class DocumentationBuildingVisitor(val context: BindingContext, private fun visitChild(descriptor: DeclarationDescriptor?, data: DocumentationNode) { if (descriptor != null && descriptor.isUserCode()) { - if (options.includeNonPublic || descriptor !is MemberDescriptor || descriptor.getVisibility().isPublicAPI()) { + if (options.includeNonPublic + || descriptor !is MemberDescriptor + || descriptor.getVisibility() in visibleToDocumentation) { descriptor.accept(this, data) } } diff --git a/src/main.kt b/src/main.kt index 24407e6a..d30f3035 100644 --- a/src/main.kt +++ b/src/main.kt @@ -54,7 +54,7 @@ public fun main(args: Array<String>) { context.getPackageFragment(file)!!.fqName }.toSet() - context.createDocumentationModule(arguments.moduleName, module, packageSet, DocumentationOptions(true)) + context.createDocumentationModule(arguments.moduleName, module, packageSet) } val timeAnalyse = System.currentTimeMillis() - startAnalyse println("done in ${timeAnalyse / 1000} secs") |