From fa3e2920c0be01874ba40eebc87ed30f97cdeec7 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 5 Oct 2020 15:45:45 +0200 Subject: =?UTF-8?q?Remove=20@=20syntax=20in=20diagnostics=20macros=20?= =?UTF-8?q?=F0=9F=97=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eval/args.rs | 2 +- src/eval/mod.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/eval') diff --git a/src/eval/args.rs b/src/eval/args.rs index b89ee61f..d11deac6 100644 --- a/src/eval/args.rs +++ b/src/eval/args.rs @@ -129,7 +129,7 @@ impl Args { pub fn done(&self, ctx: &mut LayoutContext) { for entry in self.0.v.values() { let span = entry.key_span.join(entry.value.span); - error!(@ctx.f, span, "unexpected argument"); + ctx.diag(error!(span, "unexpected argument")); } } } diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 4ec29056..6f882ab8 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -100,7 +100,7 @@ impl Eval for ExprCall { (func.clone())(args, ctx).await } else { if !name.is_empty() { - error!(@ctx.f, span, "unknown function"); + ctx.diag(error!(span, "unknown function")); ctx.f.decos.push(Deco::Unresolved.span_with(span)); } Value::Dict(dict) @@ -159,7 +159,7 @@ fn neg(ctx: &mut LayoutContext, span: Span, value: Value) -> Value { Relative(v) => Relative(-v), Linear(v) => Linear(-v), v => { - error!(@ctx.f, span, "cannot negate {}", v.ty()); + ctx.diag(error!(span, "cannot negate {}", v.ty())); Value::Error } } @@ -196,7 +196,7 @@ fn add(ctx: &mut LayoutContext, span: Span, lhs: Value, rhs: Value) -> Value { (Commands(a), Commands(b)) => Commands(concat(a, b)), (a, b) => { - error!(@ctx.f, span, "cannot add {} and {}", a.ty(), b.ty()); + ctx.diag(error!(span, "cannot add {} and {}", a.ty(), b.ty())); Value::Error } } @@ -225,7 +225,7 @@ fn sub(ctx: &mut LayoutContext, span: Span, lhs: Value, rhs: Value) -> Value { (Linear(a), Linear(b)) => Linear(a - b), (a, b) => { - error!(@ctx.f, span, "cannot subtract {1} from {0}", a.ty(), b.ty()); + ctx.diag(error!(span, "cannot subtract {1} from {0}", a.ty(), b.ty())); Value::Error } } @@ -260,7 +260,7 @@ fn mul(ctx: &mut LayoutContext, span: Span, lhs: Value, rhs: Value) -> Value { (Str(a), Int(b)) => Str(a.repeat(b.max(0) as usize)), (a, b) => { - error!(@ctx.f, span, "cannot multiply {} with {}", a.ty(), b.ty()); + ctx.diag(error!(span, "cannot multiply {} with {}", a.ty(), b.ty())); Value::Error } } @@ -285,7 +285,7 @@ fn div(ctx: &mut LayoutContext, span: Span, lhs: Value, rhs: Value) -> Value { (Linear(a), Float(b)) => Linear(a / b), (a, b) => { - error!(@ctx.f, span, "cannot divide {} by {}", a.ty(), b.ty()); + ctx.diag(error!(span, "cannot divide {} by {}", a.ty(), b.ty())); Value::Error } } -- cgit v1.2.3