@@ -36,12 +36,6 @@ pub type Annotations<'a, A> = HashMap<&'a Expression, HashSet<A>>;
3636/// Returns a map of each expression to all annotations that any of its descendent (child)
3737/// expressions are annotated with.
3838///
39- /// This uses a specialized traversal strategy with early termination:
40- /// - If a node is directly annotated (non-empty), it uses only those annotations and
41- /// **skips traversing its children entirely**
42- /// - If a node is not directly annotated (empty), it traverses children and bubbles up
43- /// their annotations
44- ///
4539/// This "skip" behavior makes this function different from [`label_tree`], which always
4640/// visits all nodes. Use this when you want to find the "shallowest" matches in a tree.
4741///
@@ -70,11 +64,8 @@ impl<'a, A: AnnotationFn> NodeVisitor<'a> for AnnotationVisitor<'a, A> {
7064 fn visit_down ( & mut self , node : & ' a Self :: NodeTy ) -> VortexResult < TraversalOrder > {
7165 let annotations = ( self . annotate ) ( node) ;
7266 if annotations. is_empty ( ) {
73- // If the annotate fn returns empty, we do not annotate this node directly.
74- // Continue traversing to check children.
7567 Ok ( TraversalOrder :: Continue )
7668 } else {
77- // Node is directly annotated - store these annotations and skip children
7869 self . annotations
7970 . entry ( node)
8071 . or_default ( )
@@ -84,7 +75,6 @@ impl<'a, A: AnnotationFn> NodeVisitor<'a> for AnnotationVisitor<'a, A> {
8475 }
8576
8677 fn visit_up ( & mut self , node : & ' a Expression ) -> VortexResult < TraversalOrder > {
87- // Bubble up child annotations to this node
8878 let child_annotations = node
8979 . children ( )
9080 . iter ( )
@@ -99,6 +89,3 @@ impl<'a, A: AnnotationFn> NodeVisitor<'a> for AnnotationVisitor<'a, A> {
9989 Ok ( TraversalOrder :: Continue )
10090 }
10191}
102-
103- // Keep the old name for backwards compatibility
104- pub use descendent_annotation_union_set as descendent_annotations;
0 commit comments