FIR IDE: implement incremental function analysis
This commit is contained in:
@@ -281,14 +281,19 @@ inline fun <reified T : PsiElement> PsiElement.collectDescendantsOfType(noinline
|
||||
inline fun <reified T : PsiElement> PsiElement.collectDescendantsOfType(
|
||||
crossinline canGoInside: (PsiElement) -> Boolean,
|
||||
noinline predicate: (T) -> Boolean = { true }
|
||||
): List<T> {
|
||||
val result = ArrayList<T>()
|
||||
): List<T> = collectDescendantsOfTypeTo(ArrayList(), canGoInside, predicate)
|
||||
|
||||
inline fun <reified T : PsiElement, C : MutableCollection<T>> PsiElement.collectDescendantsOfTypeTo(
|
||||
to: C,
|
||||
crossinline canGoInside: (PsiElement) -> Boolean,
|
||||
noinline predicate: (T) -> Boolean = { true }
|
||||
): C {
|
||||
forEachDescendantOfType<T>(canGoInside) {
|
||||
if (predicate(it)) {
|
||||
result.add(it)
|
||||
to.add(it)
|
||||
}
|
||||
}
|
||||
return result
|
||||
return to
|
||||
}
|
||||
|
||||
// ----------- Working with offsets, ranges and texts ----------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user