Utilize MemberScope.findFirstFunction with name and predicate
This commit is contained in:
committed by
Ilya Kirillov
parent
26e7fc9da3
commit
476e65f934
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.resolve.scopes
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope.Companion.ALL_NAME_FILTER
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
@@ -66,6 +67,9 @@ fun MemberScope.computeAllNames() = getClassifierNames()?.let { classifierNames
|
||||
}
|
||||
}
|
||||
|
||||
inline fun MemberScope.findFirstFunction(name: String, predicate: (CallableMemberDescriptor) -> Boolean) =
|
||||
getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).first(predicate)
|
||||
|
||||
fun Iterable<MemberScope>.flatMapClassifierNamesOrNull(): MutableSet<Name>? =
|
||||
flatMapToNullable(hashSetOf(), MemberScope::getClassifierNames)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user