about summary refs log tree commit diff
path: root/tvix/eval/src/opcode.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-13T14·34+0300
committertazjin <tazjin@tvl.su>2022-08-28T17·50+0000
commit691a596aac0381d7794c6969cb9793131aa998f3 (patch)
tree24c0f446f54986b9da070d9f7305d62b97dcdd4c /tvix/eval/src/opcode.rs
parentbbad338017c94efbf3fa966528b8e9c751449328 (diff)
feat(tvix/eval): compile simple `let ... in ...` expressions r/4522
These expressions now leave the binding values on the stack, and clean
up the scope after the body of the expression.

While variable access is not yet implemented (as the identifier node
remains unhandled), this already gives us the correct stack behaviour.

Change-Id: I138c20ace9c64502c94b2c0f99a6077cd912c00d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6188
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/opcode.rs')
-rw-r--r--tvix/eval/src/opcode.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs
index 4cf4f695b0c7..ebd91dd43924 100644
--- a/tvix/eval/src/opcode.rs
+++ b/tvix/eval/src/opcode.rs
@@ -61,4 +61,7 @@ pub enum OpCode {
 
     // Type assertion operators
     OpAssertBool,
+
+    // Close scopes while leaving their expression value around.
+    OpCloseScope(usize), // number of locals to pop
 }