From 0dd5ea3c1492b15bd386ec5c2c8d6e467a8f72a9 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 14 Jan 2015 13:30:43 +0100 Subject: link overriding functions to the corresponding base class functions --- src/Formats/StructuredFormatService.kt | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/Formats') diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index 3f505e37..bfb69d1d 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -119,23 +119,35 @@ public abstract class StructuredFormatService(val locationService: LocationServi for ((summary, items) in breakdownBySummary) { items.forEach { appendBlockCode(to, formatText(location, languageService.render(it))) - val deprecation = it.deprecation - if (deprecation != null) { - val deprecationParameter = deprecation.details(DocumentationNode.Kind.Parameter).firstOrNull() - val deprecationValue = deprecationParameter?.details(DocumentationNode.Kind.Value)?.firstOrNull() - if (deprecationValue != null) { - to.append(formatStrong("Deprecated: ")) - appendLine(to, formatText(deprecationValue.name.trim("\""))) - } else { - appendLine(to, formatStrong("Deprecated")) - } - } + it.appendOverrides(to) + it.appendDeprecation(to) } appendLine(to, summary) appendLine(to) } } + private fun DocumentationNode.appendOverrides(to: StringBuilder) { + overrides.forEach { + to.append("Overrides ") + val location = locationService.relativeLocation(this, it, extension) + appendLine(to, formatLink(FormatLink(it.owner!!.name + "." + it.name, location))) + } + } + + private fun DocumentationNode.appendDeprecation(to: StringBuilder) { + if (deprecation != null) { + val deprecationParameter = deprecation!!.details(DocumentationNode.Kind.Parameter).firstOrNull() + val deprecationValue = deprecationParameter?.details(DocumentationNode.Kind.Value)?.firstOrNull() + if (deprecationValue != null) { + to.append(formatStrong("Deprecated: ")) + appendLine(to, formatText(deprecationValue.name.trim("\""))) + } else { + appendLine(to, formatStrong("Deprecated")) + } + } + } + fun appendLocation(location: Location, to: StringBuilder, nodes: Iterable) { val breakdownByName = nodes.groupBy { node -> node.name } for ((name, items) in breakdownByName) { -- cgit