Array types

This commit is contained in:
2026-07-05 02:37:48 +02:00
parent b6256283a6
commit 13664413c5
5 changed files with 34 additions and 4 deletions
+8 -3
View File
@@ -78,9 +78,7 @@ impl RustCodegen {
}
pub fn generate(&mut self, toplevels: Vec<TopLevel>) -> String {
let mut ctx = Context {
expr_super: None,
};
let mut ctx = Context { expr_super: None };
for tl in toplevels {
tl.gen_rust(&mut ctx, self);
@@ -275,6 +273,13 @@ impl GetRust for TypeExpr {
return_type.get_rust(),
)
}
Self::Array(ty, count) => {
if let Some(count) = count {
format!("[{}; {count}]", ty.get_rust())
} else {
format!("[{}]", ty.get_rust())
}
}
}
}
}