tamer: asg::air::ir::sum_ir: impl Token for IR sum type
This is necessary for the commit that follows. Maybe it wasn't worth separating this into its own commit. DEV-13708main
parent
b6d0569b99
commit
e2714ce73f
|
@ -250,6 +250,17 @@ macro_rules! sum_ir {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for $sumty {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
$(
|
||||
#[allow(unused_variables)]
|
||||
$sumty::$subty(x) => std::fmt::Display::fmt(x, f),
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(
|
||||
impl std::fmt::Display for $subty {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
|
@ -283,6 +294,20 @@ macro_rules! sum_ir {
|
|||
}
|
||||
}
|
||||
|
||||
impl crate::parse::Token for $sumty {
|
||||
fn ir_name() -> &'static str {
|
||||
$irname
|
||||
}
|
||||
|
||||
fn span(&self) -> crate::span::Span {
|
||||
match self {
|
||||
$(
|
||||
$sumty::$subty(x) => x.span(),
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(
|
||||
impl crate::parse::Token for $subty {
|
||||
fn ir_name() -> &'static str {
|
||||
|
|
Loading…
Reference in New Issue