Skip to content

Commit

Permalink
Unwrap moved to func! macro
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-barrett committed Jul 18, 2023
1 parent af4748f commit 8e6a0f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
4 changes: 0 additions & 4 deletions src/lem/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub(crate) fn eval_step() -> Func {
let (expr, env, cont, ctrl) = make_thunk(expr, env, cont, ctrl);
return (expr, env, cont)
})
.unwrap()
}

fn reduce() -> Func {
Expand All @@ -32,21 +31,18 @@ fn reduce() -> Func {
}
};
})
.unwrap()
}

fn apply_cont() -> Func {
func!((expr_in, env_in, cont_in, ctrl): 4 => {
return (expr_in, env_in, cont_in, ctrl)
})
.unwrap()
}

fn make_thunk() -> Func {
func!((expr_in, env_in, cont_in, ctrl): 4 => {
return (expr_in, env_in, cont_in, ctrl)
})
.unwrap()
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/lem/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ macro_rules! func {
vec![$($crate::var!($in)),*],
$size,
$crate::block!($lem),
)
).unwrap()
};
}

Expand Down
24 changes: 8 additions & 16 deletions src/lem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,7 @@ mod tests {
};
}
};
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42))];
synthesize_test_helper(&lem, inputs, SlotsCounter::default());
Expand All @@ -558,8 +557,7 @@ mod tests {
return (expr_in, env_in, cont_out_terminal);
}
};
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42))];
synthesize_test_helper(&lem, inputs, SlotsCounter::default());
Expand All @@ -574,8 +572,7 @@ mod tests {
let x: Cons = hash2(x, x);
let cont_out_terminal: Terminal;
return (x, x, cont_out_terminal);
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42))];
synthesize_test_helper(&func, inputs, SlotsCounter::new((2, 0, 0)));
Expand All @@ -586,8 +583,7 @@ mod tests {
let lem = func!((expr_in, env_in, cont_in): 3 => {
let cont_out_terminal: Terminal;
return (expr_in, env_in, cont_out_terminal);
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')];
synthesize_test_helper(&lem, inputs, SlotsCounter::default());
Expand All @@ -606,8 +602,7 @@ mod tests {
return (expr_in, env_in, cont_out_error);
}
};
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')];
synthesize_test_helper(&lem, inputs, SlotsCounter::default());
Expand Down Expand Up @@ -638,8 +633,7 @@ mod tests {
return (p, p, t);
}
};
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')];
synthesize_test_helper(&lem, inputs, SlotsCounter::new((2, 2, 2)));
Expand Down Expand Up @@ -673,8 +667,7 @@ mod tests {
return (p, p, p);
}
};
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')];
synthesize_test_helper(&lem, inputs, SlotsCounter::new((3, 3, 3)));
Expand Down Expand Up @@ -721,8 +714,7 @@ mod tests {
return (p, p, p);
}
};
})
.unwrap();
});

let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')];
synthesize_test_helper(&lem, inputs, SlotsCounter::new((4, 4, 4)));
Expand Down

0 comments on commit 8e6a0f7

Please sign in to comment.