ast: Allow type specifier in let statement

This commit is contained in:
2024-02-26 15:49:55 -06:00
parent 490d320633
commit ffa313eea8
4 changed files with 15 additions and 9 deletions

View File

@@ -252,8 +252,11 @@ mod display {
}
impl Display for Let {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let Self { mutable, name, init } = self;
let Self { mutable, name, ty, init } = self;
write!(f, "let {mutable}{name}")?;
if let Some(value) = ty {
write!(f, ": {value}")?;
}
if let Some(value) = init {
write!(f, " = {value}")?;
}