This commit is contained in:
mlokr 2024-07-19 14:39:30 +02:00
parent a88d3a5c9d
commit f964520641
No known key found for this signature in database
GPG key ID: DEA147DDEE644993

View file

@ -980,6 +980,13 @@ impl<'a> std::fmt::Display for Expr<'a> {
} }
Self::Number { value, .. } => write!(f, "{value}"), Self::Number { value, .. } => write!(f, "{value}"),
Self::Bool { value, .. } => write!(f, "{value}"), Self::Bool { value, .. } => write!(f, "{value}"),
Self::BinOp {
left: left @ Self::Ident { id, .. },
op: TokenKind::Assign,
right: Self::BinOp { left: Self::Ident { id: oid, .. }, op, right },
} if id == oid => {
write!(f, "{left} {op}= {right}")
}
Self::BinOp { left, right, op } => { Self::BinOp { left, right, op } => {
let display_branch = |f: &mut std::fmt::Formatter, expr: &Self| { let display_branch = |f: &mut std::fmt::Formatter, expr: &Self| {
if let Self::BinOp { op: lop, .. } = expr if let Self::BinOp { op: lop, .. } = expr