docs(transform): improve docs for TraverseCtx::ancestors_depth (#3194)

Update doc comment to clarify what `TraverseCtx::ancestors_depth`
returns.
This commit is contained in:
overlookmotel 2024-05-07 15:15:40 +01:00 committed by GitHub
parent ed3fa399a6
commit a4f881fff4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -84,11 +84,9 @@ impl<'a> TraverseCtx<'a> {
None
}
/// Get depth of ancestry stack.
/// i.e. How many nodes above this one in the tree.
/// Get depth in the AST.
///
/// NB: A "no parent" ancestor above `Program` counts towards this total.
/// The current node does not.
/// Count includes current node. i.e. in `Program`, depth is 1.
#[inline]
pub fn ancestors_depth(&self) -> usize {
self.stack.len()