aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Model
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/Model')
-rw-r--r--core/src/main/kotlin/Model/DocumentationNode.kt5
-rw-r--r--core/src/main/kotlin/Model/DocumentationReference.kt13
2 files changed, 15 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt
index 83897a3f..56c295cd 100644
--- a/core/src/main/kotlin/Model/DocumentationNode.kt
+++ b/core/src/main/kotlin/Model/DocumentationNode.kt
@@ -48,6 +48,7 @@ enum class NodeKind {
Signature,
ExternalLink,
+ Platform,
AllTypes,
@@ -97,8 +98,8 @@ open class DocumentationNode(val name: String,
get() = references(RefKind.Annotation).map { it.to }
val deprecation: DocumentationNode?
get() = references(RefKind.Deprecation).singleOrNull()?.to
- val sinceKotlin: DocumentationNode?
- get() = references(RefKind.SinceKotlin).singleOrNull()?.to
+ val platforms: List<String>
+ get() = references(RefKind.Platform).map { it.to.name }
// TODO: Should we allow node mutation? Model merge will copy by ref, so references are transparent, which could nice
fun addReferenceTo(to: DocumentationNode, kind: RefKind) {
diff --git a/core/src/main/kotlin/Model/DocumentationReference.kt b/core/src/main/kotlin/Model/DocumentationReference.kt
index 8263cd6a..4f28d7c3 100644
--- a/core/src/main/kotlin/Model/DocumentationReference.kt
+++ b/core/src/main/kotlin/Model/DocumentationReference.kt
@@ -19,7 +19,7 @@ enum class RefKind {
HiddenAnnotation,
Deprecation,
TopLevelPage,
- SinceKotlin
+ Platform
}
data class DocumentationReference(val from: DocumentationNode, val to: DocumentationNode, val kind: RefKind) {
@@ -71,3 +71,14 @@ class NodeReferenceGraph
references.forEach { it.resolve() }
}
}
+
+@Singleton
+class PlatformNodeRegistry {
+ private val platformNodes = hashMapOf<String, DocumentationNode>()
+
+ operator fun get(platform: String): DocumentationNode {
+ return platformNodes.getOrPut(platform) {
+ DocumentationNode(platform, Content.Empty, NodeKind.Platform)
+ }
+ }
+}