about summary refs log tree commit diff
path: root/tvix/eval/src/value/function.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/value/function.rs')
-rw-r--r--tvix/eval/src/value/function.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tvix/eval/src/value/function.rs b/tvix/eval/src/value/function.rs
new file mode 100644
index 000000000000..45efc24f09f8
--- /dev/null
+++ b/tvix/eval/src/value/function.rs
@@ -0,0 +1,28 @@
+//! This module implements the runtime representation of functions.
+use std::rc::Rc;
+
+use crate::chunk::Chunk;
+
+#[derive(Clone, Debug)]
+pub struct Lambda {
+    // name: Option<NixString>,
+    pub(crate) chunk: Rc<Chunk>,
+}
+
+impl Lambda {
+    pub fn new_anonymous() -> Self {
+        Lambda {
+            // name: None,
+            chunk: Default::default(),
+        }
+    }
+
+    pub fn chunk(&mut self) -> &mut Rc<Chunk> {
+        &mut self.chunk
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct Closure {
+    pub lambda: Lambda,
+}