collectByType

fun <T> Node.collectByType(klass: Class<T>, walker: (Node) -> Sequence<Node> = Node::walk): List<T>

T is not forced to be a subtype of Node to support using interfaces.

Return

all nodes in this AST (sub)tree that are instances of, or extend klass.

Parameters

walker

the function that generates the nodes to operate on in the desired sequence.