about summary refs log tree commit diff
path: root/tvix/eval/src/value
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/value')
-rw-r--r--tvix/eval/src/value/thunk.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/tvix/eval/src/value/thunk.rs b/tvix/eval/src/value/thunk.rs
index 1ff5beb0d472..2853a398decc 100644
--- a/tvix/eval/src/value/thunk.rs
+++ b/tvix/eval/src/value/thunk.rs
@@ -114,6 +114,14 @@ impl ThunkRepr {
             }
         }
     }
+
+    pub fn is_forced(&self) -> bool {
+        match self {
+            ThunkRepr::Evaluated(Value::Thunk(_)) => false,
+            ThunkRepr::Evaluated(_) => true,
+            _ => false,
+        }
+    }
 }
 
 /// A thunk is created for any value which requires non-strict
@@ -279,11 +287,7 @@ impl Thunk {
 
     /// Returns true if forcing this thunk will not change it.
     pub fn is_forced(&self) -> bool {
-        match *self.0.borrow() {
-            ThunkRepr::Evaluated(Value::Thunk(_)) => false,
-            ThunkRepr::Evaluated(_) => true,
-            _ => false,
-        }
+        self.0.borrow().is_forced()
     }
 
     /// Returns a reference to the inner evaluated value of a thunk.