1
0
Fork 0
forked from wry/wry

autocommit 2022-02-20 21:53:46 CET

This commit is contained in:
Julian Orth 2022-02-20 21:53:46 +01:00
parent fbb389b5e9
commit 292fa50fe7
18 changed files with 594 additions and 280 deletions

View file

@ -84,13 +84,24 @@ impl<T: NodeVisitorBase> NodeVisitor for T {
}
}
pub fn visit_containers<F: FnMut(&Rc<ContainerNode>)>(f: F) -> impl NodeVisitor {
struct V<F>(F);
impl<F: FnMut(&Rc<ContainerNode>)> NodeVisitorBase for V<F> {
fn visit_container(&mut self, node: &Rc<ContainerNode>) {
(self.0)(node);
node.visit_children(self);
}
}
V(f)
}
// pub fn visit_containers<F: FnMut(&Rc<ContainerNode>)>(f: F) -> impl NodeVisitor {
// struct V<F>(F);
// impl<F: FnMut(&Rc<ContainerNode>)> NodeVisitorBase for V<F> {
// fn visit_container(&mut self, node: &Rc<ContainerNode>) {
// (self.0)(node);
// node.visit_children(self);
// }
// }
// V(f)
// }
//
// pub fn visit_floats<F: FnMut(&Rc<FloatNode>)>(f: F) -> impl NodeVisitor {
// struct V<F>(F);
// impl<F: FnMut(&Rc<FloatNode>)> NodeVisitorBase for V<F> {
// fn visit_float(&mut self, node: &Rc<FloatNode>) {
// (self.0)(node);
// node.visit_children(self);
// }
// }
// V(f)
// }