diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-23T19·54+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-01T21·56+0000 |
commit | 6f31c895ffe2dc5dd8281d812252d5db0644ec77 (patch) | |
tree | 9e45e371bc7d066b8666a3df532c6d241ee1165b /tvix/eval/src/vm.rs | |
parent | 4715f9a3a0135e1b6bc1f24fbafc9b1ce1a9bc20 (diff) |
refactor(tvix/eval): return a lambda from the compiler r/4576
Changes the internal compiler plumbing to not just return a chunk of code, but the same chunk wrapped inside of a lambda value. This is one more step towards compiling runtime lambdas. Change-Id: If0035f8e65a2970c5ae123fc068a2396e1d8fd72 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6240 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r-- | tvix/eval/src/vm.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs index 7a6a6454eadc..c9b09be82b1c 100644 --- a/tvix/eval/src/vm.rs +++ b/tvix/eval/src/vm.rs @@ -7,7 +7,7 @@ use crate::{ chunk::Chunk, errors::{ErrorKind, EvalResult}, opcode::OpCode, - value::{NixAttrs, NixList, Value}, + value::{Lambda, NixAttrs, NixList, Value}, }; #[cfg(feature = "disassembler")] @@ -365,9 +365,9 @@ impl VM { } } -pub fn run_chunk(chunk: Chunk) -> EvalResult<Value> { +pub fn run_lambda(lambda: Lambda) -> EvalResult<Value> { let mut vm = VM { - chunk, + chunk: Rc::<Chunk>::try_unwrap(lambda.chunk).unwrap(), ip: 0, stack: vec![], with_stack: vec![], |