firstParentOrNull

fun Node.firstParentOrNull(predicate: (Node) -> Boolean): Node?

This function tries to find the first parent node that satisfies the condition specified in predicate. It starts searching in the searchNode, moving up-wards using the Node.astParent attribute.

Parameters

searchNode

the child node that we start the search from

predicate

the search predicate