about summary refs log tree commit diff
path: root/tvix/eval/src/builtins/impure.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/builtins/impure.rs')
-rw-r--r--tvix/eval/src/builtins/impure.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tvix/eval/src/builtins/impure.rs b/tvix/eval/src/builtins/impure.rs
index 348963e89313..a1bcc602dc89 100644
--- a/tvix/eval/src/builtins/impure.rs
+++ b/tvix/eval/src/builtins/impure.rs
@@ -63,15 +63,16 @@ pub fn builtins_import(
             let parsed = rnix::ast::Root::parse(&contents);
             let errors = parsed.errors();
 
+            let file = source.add_file(path.to_string_lossy().to_string(), contents);
+
             if !errors.is_empty() {
                 return Err(ErrorKind::ImportParseError {
                     path,
+                    file,
                     errors: errors.to_vec(),
                 });
             }
 
-            let file = source.add_file(path.to_string_lossy().to_string(), contents);
-
             let result = crate::compile(
                 &parsed.tree().expr().unwrap(),
                 Some(path.clone()),