Type params gen

This commit is contained in:
2026-05-04 17:25:53 +02:00
parent c3844726fe
commit 0192844d27
3 changed files with 20 additions and 2 deletions
+7 -1
View File
@@ -33,8 +33,14 @@ impl From<pest::iterators::Pair<'_, Rule>> for TypeExpr {
Rule::tuple_type => TypeExpr::Tuple(pair.into_inner().map(TypeExpr::from).collect()),
Rule::path_type => {
let mut inner = pair.into_inner();
let path = StaticPath::from(inner.next().unwrap());
let params = inner.map(TypeExpr::from).collect::<Vec<_>>();
TypeExpr::Path(StaticPath::from(inner.next().unwrap()), inner.map(TypeExpr::from).collect())
if params.len() == 0 {
TypeExpr::Path(path)
} else {
TypeExpr::PathParams(path, params)
}
}
_ => unimplemented!("{pair:#?}"),
}