childWithDescendant method

TreeSitterNode? childWithDescendant(
  1. TreeSitterNode descendant
)

Implementation

TreeSitterNode? childWithDescendant(TreeSitterNode descendant) {
  if (identical(this, descendant)) return null;
  var current = descendant;
  while (true) {
    final parent = current.parent;
    if (parent == null) break;
    if (identical(parent, this)) return current;
    current = parent;
  }
  return null;
}