Skip to content

Commit

Permalink
DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed May 21, 2024
1 parent 09c5f85 commit 4c5dead
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull

fun KtCallExpression.isCalling(fqName: FqName, bindingContext: BindingContext): Boolean {
return bindingContext != BindingContext.EMPTY &&
getResolvedCall(bindingContext)?.resultingDescriptor?.fqNameOrNull() == fqName
}
fun KtCallExpression.isCalling(fqName: FqName, bindingContext: BindingContext): Boolean =
isCalling(listOf(fqName), bindingContext)

fun KtCallExpression.isCalling(fqNames: List<FqName>, bindingContext: BindingContext): Boolean {
if (bindingContext == BindingContext.EMPTY) return false
Expand Down

0 comments on commit 4c5dead

Please sign in to comment.