about summary refs log tree commit diff
path: root/tvix/eval/src/source.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/source.rs')
-rw-r--r--tvix/eval/src/source.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/eval/src/source.rs b/tvix/eval/src/source.rs
index 0104495282..f7f922f162 100644
--- a/tvix/eval/src/source.rs
+++ b/tvix/eval/src/source.rs
@@ -54,4 +54,10 @@ impl SourceCode {
             c.find_file(span.low()).source_slice(span)
         })
     }
+
+    /// Returns the reference to the file structure that a given span
+    /// is in.
+    pub fn get_file(&self, span: Span) -> Arc<codemap::File> {
+        self.codemap().look_up_span(span).file
+    }
 }