about summary refs log tree commit diff
path: root/tvix/eval/src/eval.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-17T23·52+0300
committertazjin <tazjin@tvl.su>2022-09-18T21·12+0000
commit0e5baae7ad16ca2a5a70ba34d922cabcaa68d45e (patch)
tree02efc5d294da14df71e8bebc93de97a5d1d2835b /tvix/eval/src/eval.rs
parent5dd5c7e254f01f96a2ddfcf2c163c08833ec0061 (diff)
refactor(tvix/eval): clone the Arc<codemap::File> for the compiler r/4907
This disconnects ownership of the `File` reference in a compiler from
the calling scope, which is required for when we implement `import`.

`import` will need to carry an `Rc<RefCell<CodeMap>>` (or maybe, in
the future, Arc) to give us the ability to add new detected code
files at runtime.

Note that the choice of `Arc` over `Rc` here is not ours - it's the
codemap crate's.

Change-Id: I3aeca4ffc167acbd1701846a332d93550b56ba7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6630
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/eval.rs')
-rw-r--r--tvix/eval/src/eval.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs
index 4ed97b329d..6510ef0afb 100644
--- a/tvix/eval/src/eval.rs
+++ b/tvix/eval/src/eval.rs
@@ -45,7 +45,7 @@ pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
         crate::compiler::compile(
             root_expr,
             location,
-            &file,
+            file.clone(),
             global_builtins(),
             &mut DisassemblingObserver::new(codemap.clone(), std::io::stderr()),
         )
@@ -53,7 +53,7 @@ pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
         crate::compiler::compile(
             root_expr,
             location,
-            &file,
+            file.clone(),
             global_builtins(),
             &mut NoOpObserver::default(),
         )