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/layout/mod.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/layout/mod.rs') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 7803c747..5e4e020e 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -13,10 +13,11 @@ pub use tree::*; use crate::geom::{Insets, Point, Rect, RectExt, Sides, Size, SizeExt}; +use crate::diag::Diag; use crate::eval::{PageState, State, TextState}; use crate::font::SharedFontLoader; use crate::shaping::Shaped; -use crate::syntax::SynTree; +use crate::syntax::{Deco, Spanned, SynTree}; use crate::{Feedback, Pass}; /// Layout a syntax tree and return the produced layout. @@ -98,6 +99,18 @@ pub struct LayoutContext { pub f: Feedback, } +impl LayoutContext { + /// Add a diagnostic to the feedback. + pub fn diag(&mut self, diag: Spanned) { + self.f.diags.push(diag); + } + + /// Add a decoration to the feedback. + pub fn deco(&mut self, deco: Spanned) { + self.f.decos.push(deco); + } +} + /// The constraints for layouting a single node. #[derive(Debug, Clone)] pub struct LayoutConstraints { -- cgit v1.2.3