about summary refs log tree commit diff
path: root/tvix/eval/src/eval.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-14T22·47+0300
committertazjin <tazjin@tvl.su>2022-08-31T22·42+0000
commit0257f89917e479b77b231724c13192ec23258269 (patch)
tree7dc6cb2e77066cc26478ffaaed79831432aac14c /tvix/eval/src/eval.rs
parent89f566ef5782c967e14eee5727dce2740a3c24b4 (diff)
chore(tvix/eval): return parse errors out of eval::interpret r/4558
Change-Id: I14f25b9c85260c68be38abf07ed80121ead60c7b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6224
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/eval.rs')
-rw-r--r--tvix/eval/src/eval.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs
index d8037ea143..94290af537 100644
--- a/tvix/eval/src/eval.rs
+++ b/tvix/eval/src/eval.rs
@@ -2,14 +2,20 @@ use std::path::PathBuf;
 
 use rnix::{self, types::TypedNode};
 
-use crate::{errors::EvalResult, value::Value};
+use crate::{
+    errors::{Error, EvalResult},
+    value::Value,
+};
 
 pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
     let ast = rnix::parse(code);
 
     let errors = ast.errors();
     if !errors.is_empty() {
-        todo!()
+        for err in &errors {
+            eprintln!("parse error: {}", err);
+            return Err(Error::ParseErrors(errors));
+        }
     }
 
     if std::env::var("TVIX_DISPLAY_AST").is_ok() {