parentNode property

TreeSitterNode? get parentNode

The current visible parent within this cursor's traversal root.

Like C's ts_tree_cursor_parent_node, this does not walk above the node that the cursor was constructed or reset with.

Implementation

TreeSitterNode? get parentNode {
  _checkNotDisposed();
  return _stack.isEmpty ? null : _stack.last.parent;
}