From 6714d6574a14200175d1d3db903e50ef4267aaf7 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 26 Feb 2015 15:48:01 +0100 Subject: include receiver type and parameter types in the signature of a property --- src/Kotlin/DocumentationBuilder.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index 1d7589a5..6ce7727c 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -74,7 +74,7 @@ class DocumentationBuilder(val session: ResolveSession, fun DeclarationDescriptor.signature(): String = when(this) { is ClassDescriptor, is PackageFragmentDescriptor -> DescriptorUtils.getFqName(this).asString() - is PropertyDescriptor -> getContainingDeclaration().signature() + "#" + getName() + is PropertyDescriptor -> getContainingDeclaration().signature() + "#" + getName() + receiverSignature() is FunctionDescriptor -> getContainingDeclaration().signature() + "#" + getName() + parameterSignature() is ValueParameterDescriptor -> getContainingDeclaration().signature() + ":" + getName() is TypeParameterDescriptor -> getContainingDeclaration().signature() + "<" + getName() @@ -82,7 +82,14 @@ class DocumentationBuilder(val session: ResolveSession, else -> throw UnsupportedOperationException("Don't know how to calculate signature for $this") } - fun FunctionDescriptor.parameterSignature(): String { + fun PropertyDescriptor.receiverSignature(): String { + if (getExtensionReceiverParameter() != null || getValueParameters().size() > 0) { + return "#" + parameterSignature() + } + return "" + } + + fun CallableMemberDescriptor.parameterSignature(): String { val params = getValueParameters().map { it.getType() }.toArrayList() val extensionReceiver = getExtensionReceiverParameter() if (extensionReceiver != null) { -- cgit