void type
This commit is contained in:
+11
-1
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
i32 test() {
|
||||
std::fs::write();
|
||||
void main() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user