aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-20 19:31:48 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-20 19:31:48 +0100
commitb1296e64749b9d7250fe0284f0322ea7713c879a (patch)
tree0f10d7231332c8132819fdb352692a6e4b0c58ea
parentce4b3b663f1f0bb40f87f288e210e01ffe93e52a (diff)
downloaddokka-b1296e64749b9d7250fe0284f0322ea7713c879a.tar.gz
dokka-b1296e64749b9d7250fe0284f0322ea7713c879a.tar.bz2
dokka-b1296e64749b9d7250fe0284f0322ea7713c879a.zip
override links for properties
-rw-r--r--src/Kotlin/DocumentationBuilder.kt6
-rw-r--r--test/data/properties/propertyOverride.kt7
-rw-r--r--test/src/model/PropertyTest.kt11
3 files changed, 23 insertions, 1 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index dae1c4ea..9d9aea54 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -360,7 +360,7 @@ class DocumentationBuilder(val session: ResolveSession,
return node
}
- fun addOverrideLink(baseClassFunction: FunctionDescriptor, overridingFunction: FunctionDescriptor) {
+ fun addOverrideLink(baseClassFunction: CallableMemberDescriptor, overridingFunction: CallableMemberDescriptor) {
val source = baseClassFunction.getOriginal().getSource().getPsi()
if (source != null) {
link(overridingFunction, baseClassFunction, DocumentationReference.Kind.Override)
@@ -401,6 +401,10 @@ class DocumentationBuilder(val session: ResolveSession,
node.appendChild(it, DocumentationReference.Kind.Member)
}
+ getOverriddenDescriptors().forEach {
+ addOverrideLink(it, this)
+ }
+
register(this, node)
return node
}
diff --git a/test/data/properties/propertyOverride.kt b/test/data/properties/propertyOverride.kt
new file mode 100644
index 00000000..625d1da0
--- /dev/null
+++ b/test/data/properties/propertyOverride.kt
@@ -0,0 +1,7 @@
+open class Foo() {
+ open val xyzzy: Int get() = 0
+}
+
+class Bar(): Foo() {
+ override val xyzzy: Int get() = 1
+}
diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt
index d6de84bb..1a9ef995 100644
--- a/test/src/model/PropertyTest.kt
+++ b/test/src/model/PropertyTest.kt
@@ -126,4 +126,15 @@ public class PropertyTest {
}
}
}
+
+ Test fun propertyOverride() {
+ verifyModel("test/data/properties/propertyOverride.kt") { model ->
+ with(model.members.single().members.single { it.name == "Bar" }.members.single { it.name == "xyzzy"}) {
+ assertEquals("xyzzy", name)
+ val override = references(DocumentationReference.Kind.Override).single().to
+ assertEquals("xyzzy", override.name)
+ assertEquals("Foo", override.owner!!.name)
+ }
+ }
+ }
}