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