refactor(tvix/eval): remove code and location from struct
Instead, it's passed in the evaluate/compile_only functions, which feels more naturally. It lets us set up the Evaluation struct long before we actually feed it with data to evaluate. Now that Evaluation::new() would be accepting an empty list of arguments, we can simply implement Default, making things a bit more idiomatic. Change-Id: I4369658634909a0c504fdffa18242a130daa0239 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10475 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
a5c5f1a29e
commit
4fba57c2c9
10 changed files with 72 additions and 69 deletions
|
|
@ -51,12 +51,12 @@ fn nix_eval(expr: &str, strictness: Strictness) -> String {
|
|||
#[track_caller]
|
||||
fn compare_eval(expr: &str, strictness: Strictness) {
|
||||
let nix_result = nix_eval(expr, strictness);
|
||||
let mut eval = tvix_eval::Evaluation::new(expr, None);
|
||||
let mut eval = tvix_eval::Evaluation::default();
|
||||
eval.strict = matches!(strictness, Strictness::Strict);
|
||||
eval.io_handle = Box::new(tvix_eval::StdIO);
|
||||
|
||||
let tvix_result = eval
|
||||
.evaluate()
|
||||
.evaluate(expr, None)
|
||||
.value
|
||||
.expect("tvix evaluation should succeed")
|
||||
.to_string();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue