mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 12:22:42 +00:00
minor stuff
This commit is contained in:
parent
128c2771dc
commit
f6dbc17f92
3 changed files with 20 additions and 15 deletions
|
|
@ -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 } => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue