Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
yihozhang committed Oct 3, 2024
1 parent ae964b4 commit f6944e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ enum Instruction {
/// Pop function arguments off the stack, calls the function,
/// and push the result onto the stack. The bool indicates
/// whether to make defaults.
///
///
/// This should be set to true after we disallow lookup in rule's actions and :default keyword
/// Currently, it's true when has_default() || is_datatype()
CallFunction(Symbol, bool),
Expand Down
11 changes: 3 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,13 @@ impl EGraph {

for (inputs, old, new) in merges {
if let Some(prog) = function.merge.on_merge.clone() {
self.run_actions(&mut stack, &[*old, *new], &prog)
.unwrap();
self.run_actions(&mut stack, &[*old, *new], &prog).unwrap();
function = self.functions.get_mut(&func).unwrap();
stack.clear();
}
if let Some(prog) = &merge_prog {
// TODO: error handling?
self.run_actions(&mut stack, &[*old, *new], prog)
.unwrap();
self.run_actions(&mut stack, &[*old, *new], prog).unwrap();
let merged = stack.pop().expect("merges should produce a value");
stack.clear();
function = self.functions.get_mut(&func).unwrap();
Expand Down Expand Up @@ -1120,10 +1118,7 @@ impl EGraph {

// TODO make a public version of eval_expr that makes a command,
// then returns the value at the end.
fn eval_resolved_expr(
&mut self,
expr: &ResolvedExpr,
) -> Result<Value, Error> {
fn eval_resolved_expr(&mut self, expr: &ResolvedExpr) -> Result<Value, Error> {
let (actions, mapped_expr) = expr.to_core_actions(
self.type_info(),
&mut Default::default(),
Expand Down
4 changes: 1 addition & 3 deletions src/sort/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ fn call_fn(egraph: &mut EGraph, name: &Symbol, types: Vec<ArcSort>, args: Vec<Va
// Similar to how the `MergeFn::Expr` case is handled in `Egraph::perform_set`
// egraph.rebuild().unwrap();
let mut stack = vec![];
egraph
.run_actions(&mut stack, &args, &program)
.unwrap();
egraph.run_actions(&mut stack, &args, &program).unwrap();
stack.pop().unwrap()
}

0 comments on commit f6944e9

Please sign in to comment.