minor stuff

This commit is contained in:
Moritz Gmeiner 2024-09-02 01:03:06 +02:00
commit f6dbc17f92
3 changed files with 20 additions and 15 deletions

View file

@ -93,10 +93,12 @@ impl Display for Stmt {
else_branch,
} => {
writeln!(f, "if {condition}")?;
match then_branch.as_ref() {
Stmt::Block { .. } => write!(f, "{then_branch}")?,
Stmt::Block { .. } => write!(f, "{}", indent(then_branch.to_string()))?,
_ => write!(f, "{}", indent(then_branch.to_string()))?,
}
if let Some(else_branch) = else_branch {
writeln!(f, "\nelse")?;
match else_branch.as_ref() {
@ -104,6 +106,7 @@ impl Display for Stmt {
_ => write!(f, "{}", indent(else_branch.to_string()))?,
}
}
Ok(())
}
Stmt::While { condition, body } => {