Skip to content

Commit

Permalink
Refactor and annotate functions in history handling (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-ivanov-name authored Mar 6, 2024
1 parent 5e414ce commit dd07045
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 71 deletions.
12 changes: 9 additions & 3 deletions josh-core/src/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,12 +833,18 @@ pub fn unapply<'a>(
}

if let Op::Chain(a, b) = to_op(filter) {
let i = if let Ok(i) = invert(a) { invert(i)? } else { a };
let p = apply(transaction, i, parent_tree.clone())?;
// If filter "a" is invertable, use "invert(invert(a))" version of it, otherwise use as is
let a_normalized = if let Ok(a_inverted) = invert(a) {
invert(a_inverted)?
} else {
a
};
let filtered_parent_tree = apply(transaction, a_normalized, parent_tree.clone())?;

return unapply(
transaction,
a,
unapply(transaction, b, tree, p)?,
unapply(transaction, b, tree, filtered_parent_tree)?,
parent_tree,
);
}
Expand Down
Loading

0 comments on commit dd07045

Please sign in to comment.