summaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/control.rs10
-rw-r--r--src/eval/mod.rs10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/eval/control.rs b/src/eval/control.rs
index b310bfb8..166676d4 100644
--- a/src/eval/control.rs
+++ b/src/eval/control.rs
@@ -1,5 +1,5 @@
use super::{ops, EvalResult, Value};
-use crate::diag::{At, Error, TypError};
+use crate::diag::{At, TypError};
use crate::syntax::Span;
/// A control flow event that occurred during evaluation.
@@ -25,12 +25,14 @@ impl From<TypError> for Control {
impl From<Control> for TypError {
fn from(control: Control) -> Self {
match control {
- Control::Break(_, span) => Error::boxed(span, "cannot break outside of loop"),
+ Control::Break(_, span) => {
+ error!(span, "cannot break outside of loop")
+ }
Control::Continue(_, span) => {
- Error::boxed(span, "cannot continue outside of loop")
+ error!(span, "cannot continue outside of loop")
}
Control::Return(_, _, span) => {
- Error::boxed(span, "cannot return outside of function")
+ error!(span, "cannot return outside of function")
}
Control::Err(e) => e,
}
diff --git a/src/eval/mod.rs b/src/eval/mod.rs
index e00a40f2..4ccf377b 100644
--- a/src/eval/mod.rs
+++ b/src/eval/mod.rs
@@ -37,7 +37,7 @@ pub use value::*;
use unicode_segmentation::UnicodeSegmentation;
-use crate::diag::{At, Error, StrResult, Trace, Tracepoint, TypResult};
+use crate::diag::{At, StrResult, Trace, Tracepoint, TypResult};
use crate::geom::{Angle, Fractional, Length, Relative};
use crate::library;
use crate::syntax::ast::*;
@@ -725,11 +725,9 @@ impl Eval for IncludeExpr {
fn import(ctx: &mut Context, path: &str, span: Span) -> TypResult<Module> {
// Load the source file.
let full = ctx.resolve(path);
- let id = ctx.sources.load(&full).map_err(|err| {
- Error::boxed(span, match err.kind() {
- std::io::ErrorKind::NotFound => "file not found".into(),
- _ => format!("failed to load source file ({})", err),
- })
+ let id = ctx.sources.load(&full).map_err(|err| match err.kind() {
+ std::io::ErrorKind::NotFound => error!(span, "file not found"),
+ _ => error!(span, "failed to load source file ({})", err),
})?;
// Prevent cyclic importing.