From 1163ef3e413d239282b8a5fc24b708ee62c6f6a7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 26 Aug 2022 21:48:51 +0300 Subject: feat(tvix/eval): implement compilation of upvalue access 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 --- tvix/eval/src/value/function.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tvix/eval/src/value/function.rs') diff --git a/tvix/eval/src/value/function.rs b/tvix/eval/src/value/function.rs index 45efc24f09..5d7247416e 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, pub(crate) chunk: Rc, + pub(crate) upvalue_count: usize, } impl Lambda { @@ -14,6 +15,7 @@ impl Lambda { Lambda { // name: None, chunk: Default::default(), + upvalue_count: 0, } } -- cgit 1.4.1