This commit is contained in:
Jeroen Vannevel 2022-02-15 14:47:23 +00:00
parent 73e49493bd
commit c450d0ce41
No known key found for this signature in database
GPG key ID: 78EF5F52F38C49BD
7 changed files with 7 additions and 18 deletions

View file

@ -493,10 +493,10 @@ impl<'a> Printer<'a> {
w!(self, "]");
}
TypeRef::Fn(args_and_ret, varargs) => {
let (ret, args) =
let ((_, return_type), args) =
args_and_ret.split_last().expect("TypeRef::Fn is missing return type");
w!(self, "fn(");
for (i, (name, typeref)) in args.iter().enumerate() {
for (i, (_, typeref)) in args.iter().enumerate() {
if i != 0 {
w!(self, ", ");
}
@ -509,7 +509,7 @@ impl<'a> Printer<'a> {
w!(self, "...");
}
w!(self, ") -> ");
self.print_type_ref(&ret.1);
self.print_type_ref(&return_type);
}
TypeRef::Macro(_ast_id) => {
w!(self, "<macro>");

View file

@ -189,10 +189,9 @@ impl TypeRef {
}
pl.params().map(|p| (p.pat(), p.ty())).map(|it| {
println!("{it:?}");
let type_ref = TypeRef::from_ast_opt(ctx, it.1);
let name = it.0.unwrap().syntax().text().to_string();
(Some(name), type_ref)
let name = if it.0.is_some() { Some(it.0.unwrap().syntax().text().to_string()) } else { None };
(name, type_ref)
}).collect()
} else {
Vec::new()