From 0d9af81955b1946262ff49d2bba9d66015fe44d1 Mon Sep 17 00:00:00 2001 From: Selimaj Dev Date: Mon, 4 May 2026 16:56:55 +0200 Subject: [PATCH] void type --- src/codegen.rs | 12 +++++++++++- test/src/main.mist | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/codegen.rs b/src/codegen.rs index 3396d17..dd69279 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -75,7 +75,7 @@ impl Default for RustCodegen { impl GetRust for TypeExpr { fn get_rust(&self) -> String { 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("::") } } + +pub fn get_static_type_path(path: &StaticPath) -> String { + let rust_path = path.get_rust(); + + if rust_path == "void" { + format!("()") + } else { + rust_path + } +} diff --git a/test/src/main.mist b/test/src/main.mist index 3ed2575..af940c0 100644 --- a/test/src/main.mist +++ b/test/src/main.mist @@ -1,3 +1,3 @@ -i32 test() { - std::fs::write(); -} +void main() { + +} \ No newline at end of file