@@ -13,31 +13,31 @@ use crate::expr::traversal::TraversalOrder;
1313/// Label each node in an expression tree using a bottom-up traversal.
1414///
1515/// This function separates tree labeling into two distinct steps:
16- /// 1. **Label Edge **: Compute a label for each node based only on the node itself
16+ /// 1. **Label Self **: Compute a label for each node based only on the node itself
1717/// 2. **Merge Child**: Fold/accumulate labels from children into the node's self-label
1818///
1919/// The labeling process:
20- /// - First, `label_edge ` is called on the node to produce its self-label
20+ /// - First, `self_label ` is called on the node to produce its self-label
2121/// - Then, for each child, `merge_child` is called with `(self_label, child_label)`
2222/// to fold the child label into the self_label
2323/// - This produces the final label for the node
2424///
2525/// # Parameters
2626///
2727/// - `expr`: The root expression to label
28- /// - `label_edge `: Function that computes a label for a single node
28+ /// - `self_label `: Function that computes a label for a single node
2929/// - `merge_child`: Mutable function that folds child labels into an accumulator.
3030/// Takes `(self_label, child_label)` and returns the updated accumulator.
3131/// Called once per child, with the initial accumulator being the node's self-label.
3232///
3333pub fn label_tree < L : Clone > (
3434 expr : & Expression ,
35- label_edge : impl Fn ( & Expression ) -> L ,
35+ self_label : impl Fn ( & Expression ) -> L ,
3636 mut merge_child : impl FnMut ( L , & L ) -> L ,
3737) -> HashMap < & Expression , L > {
3838 let mut visitor = LabelingVisitor {
3939 labels : Default :: default ( ) ,
40- label_edge ,
40+ self_label ,
4141 merge_child : & mut merge_child,
4242 } ;
4343 expr. accept ( & mut visitor)
5151 G : FnMut ( L , & L ) -> L ,
5252{
5353 labels : HashMap < & ' a Expression , L > ,
54- label_edge : F ,
54+ self_label : F ,
5555 merge_child : & ' b mut G ,
5656}
5757
6262{
6363 type NodeTy = Expression ;
6464
65- fn visit_down ( & mut self , _node : & ' a Self :: NodeTy ) -> VortexResult < TraversalOrder > {
66- Ok ( TraversalOrder :: Continue )
67- }
68-
6965 fn visit_up ( & mut self , node : & ' a Expression ) -> VortexResult < TraversalOrder > {
70- let self_label = ( self . label_edge ) ( node) ;
66+ let self_label = ( self . self_label ) ( node) ;
7167
7268 let final_label = node. children ( ) . iter ( ) . fold ( self_label, |acc, child| {
7369 let child_label = self
0 commit comments