about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index f0764c314fb3..37d30a6c0178 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -10,6 +10,7 @@ use crate::{
     nix_search_path::NixSearchPath,
     observer::RuntimeObserver,
     opcode::{CodeIdx, Count, JumpOffset, OpCode, StackIdx, UpvalueIdx},
+    spans::LightSpan,
     unwrap_or_clone_rc,
     upvalues::Upvalues,
     value::{Builtin, Closure, CoercionKind, Lambda, NixAttrs, NixList, Thunk, Value},
@@ -211,6 +212,12 @@ impl<'o> VM<'o> {
         self.chunk().get_span(self.frame().ip - 1)
     }
 
+    /// Returns the information needed to calculate the current span,
+    /// but without performing that calculation.
+    fn current_light_span(&self) -> LightSpan {
+        LightSpan::new_delayed(self.frame().lambda.clone(), self.frame().ip - 1)
+    }
+
     /// Construct an error from the given ErrorKind and the source
     /// span of the current instruction.
     pub fn error(&self, kind: ErrorKind) -> Error {
@@ -884,7 +891,7 @@ impl<'o> VM<'o> {
                     );
                     Thunk::new_closure(blueprint)
                 } else {
-                    Thunk::new_suspended(blueprint, self.current_span())
+                    Thunk::new_suspended(blueprint, self.current_light_span())
                 };
                 let upvalues = thunk.upvalues_mut();
                 self.push(Value::Thunk(thunk.clone()));