aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt2
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt6
-rw-r--r--core/src/main/kotlin/Model/DocumentationNode.kt3
3 files changed, 6 insertions, 5 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
index 268315ef..f1d6665e 100644
--- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
+++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
@@ -60,7 +60,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder {
if (file.classes.all { skipElement(it) }) {
return
}
- val packageNode = module.findOrCreatePackageNode(file.packageName, emptyMap())
+ val packageNode = module.findOrCreatePackageNode(file.packageName, emptyMap(), refGraph)
appendClasses(packageNode, file.classes)
}
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index 827062ba..f09c1fc0 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -276,7 +276,7 @@ class DocumentationBuilder
if (options.skipEmptyPackages && declarations.none { it.isDocumented(options) }) continue
logger.info(" package $packageName: ${declarations.count()} declarations")
- val packageNode = findOrCreatePackageNode(packageName.asString(), packageContent)
+ val packageNode = findOrCreatePackageNode(packageName.asString(), packageContent, this@DocumentationBuilder.refGraph)
packageDocumentationBuilder.buildPackageDocumentation(this@DocumentationBuilder, packageName, packageNode,
declarations, allFqNames)
}
@@ -664,7 +664,7 @@ class KotlinJavaDocumentationBuilder
}
if (classDescriptors.any { it != null && it.isDocumented(options) }) {
- val packageNode = module.findOrCreatePackageNode(file.packageName, packageContent)
+ val packageNode = module.findOrCreatePackageNode(file.packageName, packageContent, documentationBuilder.refGraph)
for (descriptor in classDescriptors.filterNotNull()) {
with(documentationBuilder) {
@@ -737,7 +737,7 @@ fun DeclarationDescriptor.signature(): String = when(this) {
is FunctionDescriptor -> containingDeclaration.signature() + "$" + name + parameterSignature()
is ValueParameterDescriptor -> containingDeclaration.signature() + "/" + name
is TypeParameterDescriptor -> containingDeclaration.signature() + "*" + name
-
+ is PackageViewDescriptor -> fqName.toString()
else -> throw UnsupportedOperationException("Don't know how to calculate signature for $this")
}
diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt
index ebfce907..9aacbca0 100644
--- a/core/src/main/kotlin/Model/DocumentationNode.kt
+++ b/core/src/main/kotlin/Model/DocumentationNode.kt
@@ -140,7 +140,7 @@ val DocumentationNode.path: List<DocumentationNode>
return parent.path + this
}
-fun DocumentationNode.findOrCreatePackageNode(packageName: String, packageContent: Map<String, Content>): DocumentationNode {
+fun DocumentationNode.findOrCreatePackageNode(packageName: String, packageContent: Map<String, Content>, refGraph: NodeReferenceGraph): DocumentationNode {
val existingNode = members(NodeKind.Package).firstOrNull { it.name == packageName }
if (existingNode != null) {
return existingNode
@@ -149,6 +149,7 @@ fun DocumentationNode.findOrCreatePackageNode(packageName: String, packageConten
packageContent.getOrElse(packageName) { Content.Empty },
NodeKind.Package)
append(newNode, RefKind.Member)
+ refGraph.register(packageName, newNode)
return newNode
}