about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/compiler.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs
index 5edf83535b..cb568bfc6f 100644
--- a/tvix/eval/src/compiler.rs
+++ b/tvix/eval/src/compiler.rs
@@ -850,6 +850,13 @@ impl Compiler {
         if pops > 0 {
             self.chunk.push_op(OpCode::OpCloseScope(pops));
         }
+
+        while !scope.with_stack.is_empty()
+            && scope.with_stack[scope.with_stack.len() - 1].depth > scope.scope_depth
+        {
+            self.chunk.push_op(OpCode::OpPopWith);
+            scope.with_stack.pop();
+        }
     }
 
     fn push_local<S: Into<String>>(&mut self, name: S) {