diff --git a/crates/libs/bindgen/src/tables/method_def.rs b/crates/libs/bindgen/src/tables/method_def.rs index 1172f40c31..6098bf253e 100644 --- a/crates/libs/bindgen/src/tables/method_def.rs +++ b/crates/libs/bindgen/src/tables/method_def.rs @@ -29,6 +29,7 @@ impl MethodDef { self.impl_map().map_or("", |map| map.scope().name()) } + #[track_caller] pub fn signature(&self, namespace: &str, generics: &[Type]) -> Signature { let mut blob = self.blob(4); let call_flags = MethodCallAttributes(blob.read_usize() as u8); @@ -36,42 +37,40 @@ impl MethodDef { let mut return_type = Type::from_blob(&mut blob, None, generics); let mut return_param = None; - let params = self - .params() - .filter_map(|param| { - if param.sequence() == 0 { - if param.has_attribute("ConstAttribute") { - return_type = return_type.to_const_type(); - } + let mut params = vec![]; - return_param = Some(param); - None - } else { - let param_is_const = param.has_attribute("ConstAttribute"); - let param_is_output = param.flags().contains(ParamAttributes::Out); - let mut ty = Type::from_blob(&mut blob, None, generics); + for param in self.params() { + if param.sequence() == 0 { + if param.has_attribute("ConstAttribute") { + return_type = return_type.to_const_type(); + } - if param_is_const || !param_is_output { - ty = ty.to_const_type(); - } - if !param_is_output { - ty = ty.to_const_ptr(); - } + return_param = Some(param); + } else { + let param_is_const = param.has_attribute("ConstAttribute"); + let param_is_output = param.flags().contains(ParamAttributes::Out); + let mut ty = Type::from_blob(&mut blob, None, generics); + + if param_is_const || !param_is_output { + ty = ty.to_const_type(); + } + if !param_is_output { + ty = ty.to_const_ptr(); + } - if !param_is_output { - if let Some(attribute) = param.find_attribute("AssociatedEnumAttribute") { - if let Some((_, Value::Str(name))) = attribute.args().first() { - let overload = param.reader().unwrap_full_name(namespace, name); + if !param_is_output { + if let Some(attribute) = param.find_attribute("AssociatedEnumAttribute") { + if let Some((_, Value::Str(name))) = attribute.args().first() { + let overload = param.reader().unwrap_full_name(namespace, name); - ty = Type::PrimitiveOrEnum(Box::new(ty), Box::new(overload)); - } + ty = Type::PrimitiveOrEnum(Box::new(ty), Box::new(overload)); } } - - Some((ty, param)) } - }) - .collect(); + + params.push((ty, param)); + } + } Signature { call_flags, diff --git a/crates/libs/bindgen/src/type_map.rs b/crates/libs/bindgen/src/type_map.rs index 5e89a752b8..17fe42ae9c 100644 --- a/crates/libs/bindgen/src/type_map.rs +++ b/crates/libs/bindgen/src/type_map.rs @@ -16,6 +16,7 @@ impl TypeMap { Self(HashMap::new()) } + #[track_caller] pub fn filter(reader: &'static Reader, filter: &Filter, references: &References) -> Self { let mut dependencies = Self::new(); diff --git a/crates/libs/bindgen/src/types/cpp_interface.rs b/crates/libs/bindgen/src/types/cpp_interface.rs index 3cd8009f77..8a4427df04 100644 --- a/crates/libs/bindgen/src/types/cpp_interface.rs +++ b/crates/libs/bindgen/src/types/cpp_interface.rs @@ -423,6 +423,7 @@ impl CppInterface { quote! { #namespace #name } } + #[track_caller] pub fn dependencies(&self, dependencies: &mut TypeMap) { let base_interfaces = self.base_interfaces(); diff --git a/crates/libs/bindgen/src/types/mod.rs b/crates/libs/bindgen/src/types/mod.rs index 9bcc22bce5..c52f8951a1 100644 --- a/crates/libs/bindgen/src/types/mod.rs +++ b/crates/libs/bindgen/src/types/mod.rs @@ -201,6 +201,7 @@ impl Type { } } + #[track_caller] pub fn from_ref(code: TypeDefOrRef, enclosing: Option<&CppStruct>, generics: &[Self]) -> Self { if let TypeDefOrRef::TypeSpec(def) = code { let mut blob = def.blob(0); @@ -227,6 +228,7 @@ impl Type { .unwrap_full_name(code_name.namespace(), code_name.name()) } + #[track_caller] pub fn from_blob(blob: &mut Blob, enclosing: Option<&CppStruct>, generics: &[Self]) -> Self { // Used by WinRT to indicate that a struct input parameter is passed by reference rather than by value on the ABI. let is_const = blob.read_modifiers().iter().any(|def| { @@ -267,6 +269,7 @@ impl Type { } } + #[track_caller] fn from_blob_impl(blob: &mut Blob, enclosing: Option<&CppStruct>, generics: &[Self]) -> Self { let code = blob.read_usize(); @@ -600,6 +603,7 @@ impl Type { } } + #[track_caller] pub fn dependencies(&self, dependencies: &mut TypeMap) { let ty = self.decay();