aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Kotlin/DocumentationBuilder.kt55
-rw-r--r--test/data/format/operatorOverloading.md2
2 files changed, 1 insertions, 56 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index b30d59d7..2ac5e1ec 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.kdoc.psi.impl.KDocSection
import org.jetbrains.kotlin.kdoc.psi.impl.KDocTag
-import org.jetbrains.kotlin.lexer.KtSingleValueToken
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtModifierListOwner
@@ -31,7 +30,6 @@ import org.jetbrains.kotlin.resolve.source.getPsi
import org.jetbrains.kotlin.types.ErrorUtils
import org.jetbrains.kotlin.types.KtType
import org.jetbrains.kotlin.types.TypeProjection
-import org.jetbrains.kotlin.types.expressions.OperatorConventions
public data class DocumentationOptions(val includeNonPublic: Boolean = false,
val reportUndocumented: Boolean = true,
@@ -540,7 +538,6 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
node.appendAnnotations(this)
node.appendModifiers(this)
node.appendSourceLink(source)
- node.appendOperatorOverloadNote(this)
overriddenDescriptors.forEach {
addOverrideLink(it, this)
@@ -561,58 +558,6 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
}
}
- fun DocumentationNode.appendOperatorOverloadNote(descriptor: FunctionDescriptor) {
- val operatorName = descriptor.getImplementedOperator()
- if (operatorName != null) {
- val content = Content()
- content.append(ContentText("Implements "))
- content.strong {
- text("operator ")
- code {
- text(operatorName)
- }
- }
- val noteNode = DocumentationNode("", content, DocumentationNode.Kind.OverloadGroupNote)
- append(noteNode, DocumentationReference.Kind.Detail)
- }
- }
-
- fun FunctionDescriptor.getImplementedOperator(): String? {
- var arity = valueParameters.size
- if (containingDeclaration is ClassDescriptor) {
- arity++
- }
- if (extensionReceiverParameter != null) {
- arity++
- }
-
- val token = if (arity == 2) {
- OperatorConventions.BINARY_OPERATION_NAMES.inverse()[name] ?:
- OperatorConventions.ASSIGNMENT_OPERATIONS.inverse()[name] ?:
- OperatorConventions.BOOLEAN_OPERATIONS.inverse()[name]
- } else if (arity == 1) {
- OperatorConventions.UNARY_OPERATION_NAMES.inverse()[name]
- }
- else null
-
- if (token is KtSingleValueToken) {
- return token.value
- }
-
- val name = name.asString()
- if (arity == 2 && name == "contains") {
- return "in"
- }
- if (arity >= 2 && (name == "get" || name == "set")) {
- return "[]"
- }
- if (arity == 2 && name == "equals" && valueParameters.size == 1 &&
- KotlinBuiltIns.isNullableAny(valueParameters.first().type)) {
- return "=="
- }
- return null
- }
-
fun PropertyDescriptor.build(): DocumentationNode {
val node = DocumentationNode(this, if (inCompanionObject()) Kind.CompanionObjectProperty else Kind.Property)
node.appendInPageChildren(typeParameters, DocumentationReference.Kind.Detail)
diff --git a/test/data/format/operatorOverloading.md b/test/data/format/operatorOverloading.md
index fd0fa977..05fe3206 100644
--- a/test/data/format/operatorOverloading.md
+++ b/test/data/format/operatorOverloading.md
@@ -4,5 +4,5 @@
# plus
`fun plus(other: [C](test/-c/index)): [C](test/-c/index)`
-Implements **operator `+`**
+