From a4f881fff4537d1dcd2945ba6cda9248d47c3a9d Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 7 May 2024 15:15:40 +0100 Subject: [PATCH] docs(transform): improve docs for `TraverseCtx::ancestors_depth` (#3194) Update doc comment to clarify what `TraverseCtx::ancestors_depth` returns. --- crates/oxc_traverse/src/context.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/oxc_traverse/src/context.rs b/crates/oxc_traverse/src/context.rs index d1b744759..eed575f4c 100644 --- a/crates/oxc_traverse/src/context.rs +++ b/crates/oxc_traverse/src/context.rs @@ -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()