feat(tvix/eval): Add Compiler::thunk method for emitting thunks

The logic in this method is *very* similar to `compile_lambda`. It is
intended to be called around any expression that should be
thunked (such as function applications, attribute set values, etc.).

Change-Id: Idfbb2daa9f4b735095378fb9c39a2fd07c8cff91
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6344
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-08-28 23:53:20 +03:00 committed by tazjin
parent 1f37275cfb
commit d1798444be
3 changed files with 41 additions and 1 deletions

View file

@ -107,6 +107,9 @@ pub enum OpCode {
OpGetUpvalue(UpvalueIdx),
OpClosure(ConstantIdx),
// Thunks
OpThunk(ConstantIdx),
/// Finalise initialisation of the upvalues of the value in the
/// given stack index after the scope is fully bound.
OpFinalise(StackIdx),