summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-13 12:21:14 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-13 14:33:58 +0200
commit144f20882136ef81b79d77bd8a68f42b76c66676 (patch)
tree7a452ab2a092f674d93cd994d80b88cc6808e540 /src/library
parentd002cdf451e1c6efbf7cd7f2303264526b6f8a92 (diff)
Add file information to spans
Diffstat (limited to 'src/library')
-rw-r--r--src/library/elements.rs2
-rw-r--r--src/library/layout.rs2
-rw-r--r--src/library/text.rs2
-rw-r--r--src/library/utility.rs7
4 files changed, 6 insertions, 7 deletions
diff --git a/src/library/elements.rs b/src/library/elements.rs
index 98165204..f0e36994 100644
--- a/src/library/elements.rs
+++ b/src/library/elements.rs
@@ -17,7 +17,7 @@ pub fn image(ctx: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> {
let full = ctx.make_path(&path.v);
let id = ctx.images.load(&full).map_err(|err| {
- Error::boxed(args.source, path.span, match err.kind() {
+ Error::boxed(path.span, match err.kind() {
io::ErrorKind::NotFound => "file not found".into(),
_ => format!("failed to load image ({})", err),
})
diff --git a/src/library/layout.rs b/src/library/layout.rs
index 0d778206..53e3a450 100644
--- a/src/library/layout.rs
+++ b/src/library/layout.rs
@@ -6,7 +6,7 @@ use crate::paper::{Paper, PaperClass};
pub fn page(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> {
let paper = match args.eat::<Spanned<EcoString>>() {
Some(name) => match Paper::from_name(&name.v) {
- None => bail!(args.source, name.span, "invalid paper name"),
+ None => bail!(name.span, "invalid paper name"),
paper => paper,
},
None => None,
diff --git a/src/library/text.rs b/src/library/text.rs
index cd97691c..55cabd15 100644
--- a/src/library/text.rs
+++ b/src/library/text.rs
@@ -132,7 +132,7 @@ pub fn lang(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> {
if dir.v.axis() == SpecAxis::Horizontal {
Some(dir.v)
} else {
- bail!(args.source, dir.span, "must be horizontal");
+ bail!(dir.span, "must be horizontal");
}
} else {
iso.as_deref().map(lang_dir)
diff --git a/src/library/utility.rs b/src/library/utility.rs
index 22bde3a1..20d10830 100644
--- a/src/library/utility.rs
+++ b/src/library/utility.rs
@@ -25,7 +25,7 @@ pub fn len(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> {
Value::Str(v) => Value::Int(v.len() as i64),
Value::Array(v) => Value::Int(v.len()),
Value::Dict(v) => Value::Int(v.len()),
- _ => bail!(args.source, span, "expected string, array or dictionary"),
+ _ => bail!(span, "expected string, array or dictionary"),
})
}
@@ -35,7 +35,7 @@ pub fn rgb(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> {
if let Some(string) = args.eat::<Spanned<EcoString>>() {
match RgbaColor::from_str(&string.v) {
Ok(color) => color,
- Err(_) => bail!(args.source, string.span, "invalid color"),
+ Err(_) => bail!(string.span, "invalid color"),
}
} else {
let r = args.expect("red component")?;
@@ -60,7 +60,7 @@ pub fn max(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> {
/// Find the minimum or maximum of a sequence of values.
fn minmax(args: &mut FuncArgs, goal: Ordering) -> TypResult<Value> {
- let &mut FuncArgs { source, span, .. } = args;
+ let span = args.span;
let mut extremum = args.expect::<Value>("value")?;
for value in args.all::<Value>() {
@@ -71,7 +71,6 @@ fn minmax(args: &mut FuncArgs, goal: Ordering) -> TypResult<Value> {
}
}
None => bail!(
- source,
span,
"cannot compare {} with {}",
extremum.type_name(),