about summary refs log tree commit diff
path: root/tvix/eval/src/value
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-26T18·48+0300
committertazjin <tazjin@tvl.su>2022-09-03T21·55+0000
commit1163ef3e413d239282b8a5fc24b708ee62c6f6a7 (patch)
tree21f1085fdd7095c54a55059d7b7a7b2f9f1139a7 /tvix/eval/src/value
parent2f93ed297e3cef8486e9160f5d3d68be1939d7d5 (diff)
feat(tvix/eval): implement compilation of upvalue access r/4623
This adds a new upvalue tracking structure in the compiler to resolve
upvalues and track their positions within a function when compiling a
closure.

The compiler will emit runtime upvalue access instructions after this
commit, but the creation of the runtime closure object etc. is not yet
wired up.

Change-Id: Ib0c2c25f686bfd45f797c528753068858e3a770d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6289
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/value')
-rw-r--r--tvix/eval/src/value/function.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/tvix/eval/src/value/function.rs b/tvix/eval/src/value/function.rs
index 45efc24f09f8..5d7247416ee0 100644
--- a/tvix/eval/src/value/function.rs
+++ b/tvix/eval/src/value/function.rs
@@ -7,6 +7,7 @@ use crate::chunk::Chunk;
 pub struct Lambda {
     // name: Option<NixString>,
     pub(crate) chunk: Rc<Chunk>,
+    pub(crate) upvalue_count: usize,
 }
 
 impl Lambda {
@@ -14,6 +15,7 @@ impl Lambda {
         Lambda {
             // name: None,
             chunk: Default::default(),
+            upvalue_count: 0,
         }
     }