aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorDouglas Sigelbaum <sigelbaum@google.com>2018-04-24 20:27:21 -0700
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-07-14 23:44:41 +0300
commit54874733ff84998d26e21b57384ad3b2ca151fc2 (patch)
tree28972de08b527504476e55c4327516192ead5640 /core/src
parent27deff9e3f8bb2190115f2e5f68f859f46af11a3 (diff)
downloaddokka-54874733ff84998d26e21b57384ad3b2ca151fc2.tar.gz
dokka-54874733ff84998d26e21b57384ad3b2ca151fc2.tar.bz2
dokka-54874733ff84998d26e21b57384ad3b2ca151fc2.zip
[backport] Added logic for inherited constants.
Also, switched to using recursively inherited members instead of just inherited members in the immediate super class. Original: 56c3558
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Model/DocumentationNode.kt18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt
index 4739d736..ca298802 100644
--- a/core/src/main/kotlin/Model/DocumentationNode.kt
+++ b/core/src/main/kotlin/Model/DocumentationNode.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka
+import org.jetbrains.dokka.Formats.constantValue
import java.util.*
enum class NodeKind {
@@ -86,6 +87,8 @@ open class DocumentationNode(val name: String,
get() = references(RefKind.Member).map { it.to }
val inheritedMembers: List<DocumentationNode>
get() = references(RefKind.InheritedMember).map { it.to }
+ val allInheritedMembers: List<DocumentationNode>
+ get() = recursiveInheritedMembers()
val inheritedCompanionObjectMembers: List<DocumentationNode>
get() = references(RefKind.InheritedCompanionObjectMember).map { it.to }
val extensions: List<DocumentationNode>
@@ -145,7 +148,6 @@ open class DocumentationNode(val name: String,
}
(content as MutableContent).body()
}
-
fun details(kind: NodeKind): List<DocumentationNode> = details.filter { it.kind == kind }
fun members(kind: NodeKind): List<DocumentationNode> = members.filter { it.kind == kind }
fun inheritedMembers(kind: NodeKind): List<DocumentationNode> = inheritedMembers.filter { it.kind == kind }
@@ -217,3 +219,17 @@ fun DocumentationNode.qualifiedName(): String {
}
fun DocumentationNode.simpleName() = name.substringAfterLast('.')
+
+private fun DocumentationNode.recursiveInheritedMembers(): List<DocumentationNode> {
+ val allInheritedMembers = mutableListOf<DocumentationNode>()
+ recursiveInheritedMembers(allInheritedMembers)
+ return allInheritedMembers
+}
+
+private fun DocumentationNode.recursiveInheritedMembers(allInheritedMembers: MutableList<DocumentationNode>) {
+ allInheritedMembers.addAll(inheritedMembers)
+ System.out.println(allInheritedMembers.size)
+ inheritedMembers.groupBy { it.owner!! } .forEach { (node, _) ->
+ node.recursiveInheritedMembers(allInheritedMembers)
+ }
+} \ No newline at end of file