tamer: xir::parse::attr: Display: element name

This resolves a TODO by including the name of the element whose attributes
are currently being parsed.

This also frees a parent from having to provide additional context, allowing
Display to be fully delegated when stitching.

DEV-7145
main
Mike Gerwitz 2022-07-18 14:42:13 -04:00
parent 2f4c20dac8
commit f462c7daec
1 changed files with 11 additions and 2 deletions

View File

@ -303,8 +303,17 @@ macro_rules! attr_parse {
/// Additional error context shown in diagnostic messages for
/// certain variants of [`ParseError`].
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
// TODO
write!(f, "parsing attributes")
use crate::fmt::{DisplayWrapper, TtQuote};
match self {
Self { ___ctx: (ele, _), .. } => {
write!(
f,
"parsing attributes for element {}",
TtQuote::wrap(ele)
)
}
}
}
}