Reverted old behaviour of DescriptorToSourceUtils.descriptorToDeclaration()
This commit is contained in:
@@ -59,17 +59,12 @@ public object DescriptorToSourceUtils {
|
|||||||
|
|
||||||
// NOTE this is also used by KDoc
|
// NOTE this is also used by KDoc
|
||||||
// Returns PSI element for descriptor. If there are many relevant elements (e.g. it is fake override
|
// Returns PSI element for descriptor. If there are many relevant elements (e.g. it is fake override
|
||||||
// with multiple declarations), finds any of them. It can't find declarations in builtins or decompiled code.
|
// with multiple declarations), returns null. It can't find declarations in builtins or decompiled code.
|
||||||
// In IDE, use DescriptorToSourceUtilsIde instead.
|
// In IDE, use DescriptorToSourceUtilsIde instead.
|
||||||
platformStatic
|
platformStatic
|
||||||
public fun descriptorToDeclaration(descriptor: DeclarationDescriptor): PsiElement? {
|
public fun descriptorToDeclaration(descriptor: DeclarationDescriptor): PsiElement? {
|
||||||
for (declarationDescriptor in getEffectiveReferencedDescriptors(descriptor.getOriginal())) {
|
val effectiveReferencedDescriptors = getEffectiveReferencedDescriptors(descriptor)
|
||||||
val source = getSourceFromDescriptor(declarationDescriptor)
|
return if (effectiveReferencedDescriptors.size() == 1) getSourceFromDescriptor(effectiveReferencedDescriptors.firstOrNull()!!) else null
|
||||||
if (source != null) {
|
|
||||||
return source
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
platformStatic
|
platformStatic
|
||||||
|
|||||||
Reference in New Issue
Block a user