@@ -75,33 +75,31 @@ impl CachedSet {
7575 // node has.
7676 fn trace(&self, node: &Node) -> FxHashSet<CacheId> {
7777 let mut edges = FxHashSet::default();
78+ self.trace_recursive(&mut edges, node);
79+ edges
80+ }
7881
79− let bump = Bump::new();
80− let mut stack = bumpalo::collections::Vec::with_capacity_in(64, &bump);
81− stack.push(node);
82−
83− while let Some(node) = stack.pop() {
84− match &node.kind {
85− NodeKind::Text(_) => continue,
86− NodeKind::Cached(c) => {
87− debug_assert!(self.items.contains_key(&c.id));
88− edges.insert(c.id);
89− edges.extend(
90− self.items
91− .get(&c.id)
92− .expect_throw("CachedSet::trace: should have c.id in cached set")
93− .edges
94− .iter()
95− .cloned(),
96− );
97− }
98− NodeKind::Element(el) => {
99− stack.extend(el.children);
82+ fn trace_recursive(&self, edges: &mut FxHashSet<CacheId>, node: &Node) {
83+ match &node.kind {
84+ NodeKind::Text(_) => return,
85+ NodeKind::Cached(c) => {
86+ debug_assert!(self.items.contains_key(&c.id));
87+ edges.insert(c.id);
88+ edges.extend(
89+ self.items
90+ .get(&c.id)
91+ .expect_throw("CachedSet::trace: should have c.id in cached set")
92+ .edges
93+ .iter()
94+ .cloned(),
95+ );
96+ }
97+ NodeKind::Element(el) => {
98+ for child in el.children {
99+ self.trace_recursive(edges, child);
100100 }
101101 }
102102 }
103−
104− edges
105103 }
106104
107105 fn next_id(&mut self) -> CacheId {