From 4fba57c2c90f2e7b02da9187e59f8d64deef3fb2 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 30 Dec 2023 21:36:48 +0100 Subject: 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 Autosubmit: flokli --- tvix/glue/src/builtins/mod.rs | 4 ++-- tvix/glue/src/tvix_store_io.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tvix/glue/src') diff --git a/tvix/glue/src/builtins/mod.rs b/tvix/glue/src/builtins/mod.rs index 6b39fd362ee3..86924cefef7f 100644 --- a/tvix/glue/src/builtins/mod.rs +++ b/tvix/glue/src/builtins/mod.rs @@ -39,14 +39,14 @@ mod tests { /// Takes care of setting up the evaluator so it knows about the // `derivation` builtin. fn eval(str: &str) -> EvaluationResult { - let mut eval = tvix_eval::Evaluation::new_impure(str, None); + let mut eval = tvix_eval::Evaluation::new_impure(); let known_paths: Rc> = Default::default(); add_derivation_builtins(&mut eval, known_paths.clone()); // run the evaluation itself. - eval.evaluate() + eval.evaluate(str, None) } #[test] diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs index 70ec21e74327..41cae97ebf52 100644 --- a/tvix/glue/src/tvix_store_io.rs +++ b/tvix/glue/src/tvix_store_io.rs @@ -375,7 +375,7 @@ mod tests { /// Takes care of setting up the evaluator so it knows about the // `derivation` builtin. fn eval(str: &str) -> EvaluationResult { - let mut eval = tvix_eval::Evaluation::new_impure(str, None); + let mut eval = tvix_eval::Evaluation::new_impure(); let blob_service = Arc::new(MemoryBlobService::default()); let directory_service = Arc::new(MemoryDirectoryService::default()); @@ -397,7 +397,7 @@ mod tests { add_derivation_builtins(&mut eval, known_paths.clone()); // run the evaluation itself. - eval.evaluate() + eval.evaluate(str, None) } /// Helper function that takes a &Path, and invokes a tvix evaluator coercing that path to a string -- cgit 1.4.1