From f93f138c6c4a372c7692ff235a143326c140ab23 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Tue, 25 Oct 2022 02:33:17 -0700 Subject: fix(tvix/eval): inline mis-named Local::above() 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 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7090 Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/compiler/scope.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tvix/eval/src/compiler/scope.rs b/tvix/eval/src/compiler/scope.rs index 327766bcb5..3b75bdbc42 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) -- cgit 1.4.1