Skip to content

Commit

Permalink
todos
Browse files Browse the repository at this point in the history
  • Loading branch information
Radvendii committed Sep 19, 2023
1 parent 0554cdd commit cd3d1e7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/term/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,10 @@ impl Traverse<RichTerm> for RichTerm {
todo.push((Recurse, t));
}
}
// XXX: some of these traverse through fields, types,
// etc. in order to complete this transformation,
// we need another function in the Traverse trait,
// which modifies a `&mut Vec` passed in
Term::Record(record) => {
for (_, field) in &mut record.fields {
*field = field.clone().traverse(f, order)?;
Expand Down Expand Up @@ -1796,6 +1800,13 @@ impl Traverse<RichTerm> for RichTerm {
Ok(root)
}

// XXX: The implementation of the match statement here and above are nearly
// identical, and it would be nice to unify them. The differences are:
// (1) mutable vs. immutable references,
// (2) the Recurse tacked onto everything
// (3) stack vs queue.
// (4) How we deal with traversing types. This will go away once we convert
// the other types to imperative style
fn traverse_ref<U>(&self, f: &mut dyn FnMut(&RichTerm) -> TraverseControl<U>) -> Option<U> {
let mut todo: VecDeque<&RichTerm> = VecDeque::from([self]);

Expand Down

0 comments on commit cd3d1e7

Please sign in to comment.