j
This commit is contained in:
parent
29d5774c47
commit
71359d82aa
|
@ -951,8 +951,8 @@ impl<'a> std::fmt::Display for Expr<'a> {
|
||||||
write!(f, "{}(", Postfix(func))?;
|
write!(f, "{}(", Postfix(func))?;
|
||||||
fmt_list(f, trailing_comma, ")", args, std::fmt::Display::fmt)
|
fmt_list(f, trailing_comma, ")", args, std::fmt::Display::fmt)
|
||||||
}
|
}
|
||||||
Self::Return { val: Some(val), .. } => write!(f, "return {val};"),
|
Self::Return { val: Some(val), .. } => write!(f, "return {val}"),
|
||||||
Self::Return { val: None, .. } => write!(f, "return;"),
|
Self::Return { val: None, .. } => write!(f, "return"),
|
||||||
Self::Ident { name, .. } => write!(f, "{name}"),
|
Self::Ident { name, .. } => write!(f, "{name}"),
|
||||||
Self::Block { stmts, .. } => {
|
Self::Block { stmts, .. } => {
|
||||||
write!(f, "{{")?;
|
write!(f, "{{")?;
|
||||||
|
@ -963,7 +963,7 @@ impl<'a> std::fmt::Display for Expr<'a> {
|
||||||
for _ in 0..INDENT.with(|i| i.get()) {
|
for _ in 0..INDENT.with(|i| i.get()) {
|
||||||
write!(f, "\t")?;
|
write!(f, "\t")?;
|
||||||
}
|
}
|
||||||
writeln!(f, "{stmt}")?;
|
writeln!(f, "{stmt};")?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
})();
|
})();
|
||||||
|
@ -989,15 +989,7 @@ impl<'a> std::fmt::Display for Expr<'a> {
|
||||||
|
|
||||||
display_branch(f, left)?;
|
display_branch(f, left)?;
|
||||||
write!(f, " {op} ")?;
|
write!(f, " {op} ")?;
|
||||||
display_branch(f, right)?;
|
display_branch(f, right)
|
||||||
|
|
||||||
if matches!(op, TokenKind::Decl | TokenKind::Assign)
|
|
||||||
&& !matches!(right, Self::Closure { .. })
|
|
||||||
{
|
|
||||||
write!(f, ";")?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue