From 737bbd1fc531980f13e89fff56da7d9f1dc7f6b1 Mon Sep 17 00:00:00 2001 From: Go Erik Date: Sun, 27 Aug 2023 03:04:52 +0800 Subject: [PATCH] function pointer params now has names --- csbindgen/src/type_meta.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/csbindgen/src/type_meta.rs b/csbindgen/src/type_meta.rs index b574c93..9e2146a 100644 --- a/csbindgen/src/type_meta.rs +++ b/csbindgen/src/type_meta.rs @@ -442,7 +442,8 @@ pub fn build_method_delegate_if_required( let joined_param = parameters .iter() - .map(|p| { + .enumerate() + .map(|(index, p)| { let cs = p.rust_type.to_csharp_string( options, alias_map, @@ -450,7 +451,11 @@ pub fn build_method_delegate_if_required( method_name, parameter_name, ); - format!("{} {}", cs, escape_name(p.name.as_str())) + // a is ascii for 97 + let parameter_name = char::from_u32(index as u32 + 97) + .unwrap_or('?') + .to_string(); + format!("{} {}", cs, escape_name(parameter_name.as_str())) }) .collect::>() .join(", ");