about summary refs log tree commit diff
path: root/tvix/eval/src/compiler/scope.rs
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-10-25T09·33-0700
committerclbot <clbot@tvl.fyi>2022-11-04T01·33+0000
commitf93f138c6c4a372c7692ff235a143326c140ab23 (patch)
tree28c3d868bddeae85451d8b4211ad97d4c5953849 /tvix/eval/src/compiler/scope.rs
parent06494742062e77036827dfc7c91dea507b44447f (diff)
fix(tvix/eval): inline mis-named Local::above() r/5237
If self.depth > other.depth then self is deeper than other, so self
is *below* other, not above it.  Let's just inline the function.

Change-Id: I8dda3d90cbc86c8a6fa01bc4a5e506a2e403bd20
Signed-off-by: Adam Joseph <adam@westernsemico.com>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7090
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/compiler/scope.rs')
-rw-r--r--tvix/eval/src/compiler/scope.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/tvix/eval/src/compiler/scope.rs b/tvix/eval/src/compiler/scope.rs
index 327766bcb501..3b75bdbc42fe 100644
--- a/tvix/eval/src/compiler/scope.rs
+++ b/tvix/eval/src/compiler/scope.rs
@@ -58,11 +58,6 @@ pub struct Local {
 }
 
 impl Local {
-    /// Does this local live above the other given depth?
-    pub fn above(&self, theirs: usize) -> bool {
-        self.depth > theirs
-    }
-
     /// Does the name of this local match the given string?
     pub fn has_name(&self, other: &str) -> bool {
         match &self.name {
@@ -284,7 +279,7 @@ impl Scope {
     pub fn stack_index(&self, idx: LocalIdx) -> StackIdx {
         let uninitialised_count = self.locals[..(idx.0)]
             .iter()
-            .filter(|l| !l.initialised && self[idx].above(l.depth))
+            .filter(|l| !l.initialised && self[idx].depth > l.depth)
             .count();
 
         StackIdx(idx.0 - uninitialised_count)