From 7442558b33b3f1ebcf356924b0345cb73d0524ab Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 20 Jan 2023 16:18:06 +0300 Subject: refactor(tvix/eval): keep globals alive through VM struct This forces users to pass the fully constructed set of globals to the VM, making it harder to accidentally "lose" the set while weak references to it still exist. This doesn't modify any functionality, but is laying the foundation for simplifying some of the builtins behaviour that has grown more complex again. Change-Id: I5120f97861c65dc46d90b8a4e2c92ad32cc53e03 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7877 Autosubmit: tazjin Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/eval/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/lib.rs') diff --git a/tvix/eval/src/lib.rs b/tvix/eval/src/lib.rs index a759e0c0ab..0e0f120591 100644 --- a/tvix/eval/src/lib.rs +++ b/tvix/eval/src/lib.rs @@ -213,7 +213,7 @@ impl<'code, 'co, 'ro> Evaluation<'code, 'co, 'ro> { let mut noop_observer = observer::NoOpObserver::default(); let compiler_observer = self.compiler_observer.take().unwrap_or(&mut noop_observer); - let (lambda, _globals) = match parse_compile_internal( + let (lambda, globals) = match parse_compile_internal( &mut result, self.code, self.file.clone(), @@ -246,7 +246,7 @@ impl<'code, 'co, 'ro> Evaluation<'code, 'co, 'ro> { .unwrap_or_default(); let runtime_observer = self.runtime_observer.take().unwrap_or(&mut noop_observer); - let vm_result = run_lambda(nix_path, self.io_handle, runtime_observer, lambda); + let vm_result = run_lambda(nix_path, self.io_handle, runtime_observer, globals, lambda); match vm_result { Ok(mut runtime_result) => { -- cgit 1.4.1