Fixed type/generics parsing

This commit is contained in:
2026-06-04 18:50:33 +02:00
parent 6cacfd7135
commit 202f41c0e6
6 changed files with 28 additions and 40 deletions
+7 -12
View File
@@ -208,19 +208,14 @@ pub fn get_static_type_path(path: &Path) -> String {
impl GetRust for TypeExprKind {
fn get_rust(&self) -> String {
match self {
TypeExprKind::Path(path) => get_static_type_path(path),
TypeExprKind::Lifetime(name) => format!("'{}", name.get_rust()),
TypeExprKind::PathParams(path, params) => {
format!(
"{}<{}>",
get_static_type_path(path),
params
.into_iter()
.map(|t| t.get_rust())
.collect::<Vec<_>>()
.join(", ")
)
TypeExprKind::Path(path, generics) => {
if let Some(generics) = generics {
format!("{}{}", get_static_type_path(path), generics.get_rust())
} else {
get_static_type_path(path)
}
}
TypeExprKind::Lifetime(name) => format!("'{}", name.get_rust()),
TypeExprKind::Tuple(types) => format!(
"({})",
types