about summary refs log tree commit diff
path: root/tvix/eval/src/compiler/scope.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-01T22·29+0300
committertazjin <tazjin@tvl.su>2022-09-08T13·36+0000
commit7bc6e5984dfd1f8717e28bbbcb97e078b6039558 (patch)
treeff4d9c482729a5e880872de278204856647715bf /tvix/eval/src/compiler/scope.rs
parenta303ea3ff50c68d77679e72f7b67256b992cbd94 (diff)
refactor(tvix/eval): always pass slot to compiler methods r/4753
The slot is now always known (at the root of the file it is simply
stack slot 0 once the scope drops back down to 0), so it does not need
to be wrapped in an `Option` and accessed in cumbersome ways anymore.

Change-Id: I46bf67a4cf5cb96e4874dffd0e3fb07c551d44f0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6420
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/compiler/scope.rs')
-rw-r--r--tvix/eval/src/compiler/scope.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/tvix/eval/src/compiler/scope.rs b/tvix/eval/src/compiler/scope.rs
index a50b3b79343e..7d557a7d2fd3 100644
--- a/tvix/eval/src/compiler/scope.rs
+++ b/tvix/eval/src/compiler/scope.rs
@@ -104,6 +104,10 @@ pub struct Upvalue {
 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd)]
 pub struct LocalIdx(usize);
 
+impl LocalIdx {
+    pub const ZERO: LocalIdx = LocalIdx(0);
+}
+
 /// Represents a scope known during compilation, which can be resolved
 /// directly to stack indices.
 ///