refactor(tvix/eval): return a lambda from the compiler
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>
This commit is contained in:
parent
4715f9a3a0
commit
6f31c895ff
5 changed files with 28 additions and 16 deletions
|
|
@ -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![],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue