From 1ee1d078e2480ddd08d40915bc7a74a8352acff0 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 30 Jul 2021 18:04:08 +0200 Subject: Fatal errors - Makes errors fatal, so that a phase is only reached when all previous phases were error-free - Parsing still recovers and can produce multiple errors - Evaluation fails fast and can thus produce only a single error (except for parse errors due to an import) - The single error that could occur during execution is removed for now - Removes Value::Error variant --- src/exec/mod.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/exec/mod.rs') diff --git a/src/exec/mod.rs b/src/exec/mod.rs index 8bac76e8..762b555d 100644 --- a/src/exec/mod.rs +++ b/src/exec/mod.rs @@ -8,7 +8,6 @@ pub use state::*; use std::fmt::Write; -use crate::diag::Pass; use crate::eval::{ExprMap, Template, TemplateFunc, TemplateNode, TemplateTree, Value}; use crate::geom::Gen; use crate::layout::{LayoutTree, StackChild, StackNode}; @@ -18,7 +17,7 @@ use crate::util::EcoString; use crate::Context; /// Execute a template to produce a layout tree. -pub fn exec(ctx: &mut Context, template: &Template) -> Pass { +pub fn exec(ctx: &mut Context, template: &Template) -> LayoutTree { let mut ctx = ExecContext::new(ctx); template.exec(&mut ctx); ctx.finish() @@ -138,7 +137,6 @@ impl Exec for Value { Value::Float(v) => ctx.push_text(pretty(v)), Value::Str(v) => ctx.push_text(v), Value::Template(v) => v.exec(ctx), - Value::Error => {} // For values which can't be shown "naturally", we print the // representation in monospace. other => ctx.push_monospace_text(pretty(other)), -- cgit v1.2.3