about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix')
-rw-r--r--tvix/eval/src/value/mod.rs6
-rw-r--r--tvix/eval/src/vm.rs4
2 files changed, 7 insertions, 3 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index 911af9d6ae12..2c839484145a 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -10,6 +10,7 @@ mod list;
 mod string;
 
 use crate::errors::{ErrorKind, EvalResult};
+use crate::opcode::StackIdx;
 pub use attrs::NixAttrs;
 pub use builtin::Builtin;
 pub use function::{Closure, Lambda};
@@ -36,6 +37,7 @@ pub enum Value {
     AttrNotFound,
     DynamicUpvalueMissing(NixString),
     Blueprint(Rc<Lambda>),
+    DeferredUpvalue(StackIdx),
 }
 
 impl Value {
@@ -59,7 +61,8 @@ impl Value {
             Value::AttrPath(_)
             | Value::AttrNotFound
             | Value::DynamicUpvalueMissing(_)
-            | Value::Blueprint(_) => "internal",
+            | Value::Blueprint(_)
+            | Value::DeferredUpvalue(_) => "internal",
         }
     }
 
@@ -169,6 +172,7 @@ impl Display for Value {
             Value::AttrPath(path) => write!(f, "internal[attrpath({})]", path.len()),
             Value::AttrNotFound => f.write_str("internal[not found]"),
             Value::Blueprint(_) => f.write_str("internal[blueprint]"),
+            Value::DeferredUpvalue(_) => f.write_str("internal[deferred_upvalue]"),
             Value::DynamicUpvalueMissing(name) => {
                 write!(f, "internal[no_dyn_upvalue({name})]")
             }
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index 33ea81087f64..d4eb0657251a 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -426,8 +426,8 @@ impl VM {
                                 closure.push_upvalue(value);
                             }
 
-                            OpCode::DataDeferredLocal(_idx) => {
-                                todo!("deferred local initialisation")
+                            OpCode::DataDeferredLocal(idx) => {
+                                closure.push_upvalue(Value::DeferredUpvalue(idx));
                             }
 
                             _ => panic!("compiler error: missing closure operand"),