void type

This commit is contained in:
2026-05-04 16:56:55 +02:00
parent c4bdc20276
commit 0d9af81955
2 changed files with 14 additions and 4 deletions
+11 -1
View File
@@ -75,7 +75,7 @@ impl Default for RustCodegen {
impl GetRust for TypeExpr { impl GetRust for TypeExpr {
fn get_rust(&self) -> String { fn get_rust(&self) -> String {
match self { match self {
TypeExpr::Path(path) => path.get_rust(), TypeExpr::Path(path) => get_static_type_path(path),
} }
} }
} }
@@ -314,3 +314,13 @@ impl GetRust for StaticPath {
self.0.join("::") self.0.join("::")
} }
} }
pub fn get_static_type_path(path: &StaticPath) -> String {
let rust_path = path.get_rust();
if rust_path == "void" {
format!("()")
} else {
rust_path
}
}
+3 -3
View File
@@ -1,3 +1,3 @@
i32 test() { void main() {
std::fs::write();
} }