Skip to content

Commit

Permalink
Add package declaration descriptor to DRI conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Linnea Gräf authored and vmishenev committed Mar 20, 2024
1 parent 19d7d13 commit 3829b2c
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull

internal fun DRI.Companion.from(descriptor: DeclarationDescriptor) = descriptor.parentsWithSelf.run {
if (descriptor is PackageViewDescriptor) {
return@run DRI(
packageName = descriptor.fqName.asString()
)
}
val parameter = firstIsInstanceOrNull<ValueParameterDescriptor>()
val callable = parameter?.containingDeclaration ?: firstIsInstanceOrNull<CallableDescriptor>()

Expand Down

0 comments on commit 3829b2c

Please sign in to comment.