docs: look for renamed properties getters/setters
Fixes
@@ -460,6 +460,19 @@ fn create_object_doc(w: &mut dyn Write, env: &Env, info: &analysis::object::Info
)?;
}
for property in properties {
+ let getter_name = info
+ .properties
+ .iter()
+ .filter(|p| p.is_get)
+ .find(|p| p.name == property.name)
+ .map(|p| p.func_name.clone());
+
+ let setter_name = info
+ .properties
+ .iter()
+ .filter(|p| !p.is_get)
+ .find(|p| p.name == property.name)
+ .map(|p| p.func_name.clone());
let (ty, object_location) = if has_trait {
let configured_properties = obj.properties.matched(&property.name);
if let Some(trait_name) = configured_properties
@@ -479,6 +492,8 @@ fn create_object_doc(w: &mut dyn Write, env: &Env, info: &analysis::object::Info
property,
Some(Box::new(ty)),
(&info.type_id, object_location),
+ getter_name,
+ setter_name,
)?;
}
Ok(())
@@ -768,6 +783,8 @@ fn create_property_doc(
property: &Property,
parent: Option<Box<TypeStruct>>,
in_type: (&TypeId, Option<LocationInObject>),
+ getter_name: Option<String>,
+ setter_name: Option<String>,
) -> Result<()> {
if env.is_totally_deprecated(property.deprecated_version) {
return Ok(());
@@ -784,13 +801,19 @@ fn create_property_doc(
if property.readable {
v.push(TypeStruct {
parent: parent.clone(),
- ..TypeStruct::new(SType::Fn, &format!("get_property_{}", name_for_func))
+ ..TypeStruct::new(
+ SType::Fn,
+ &getter_name.unwrap_or_else(|| name_for_func.clone()),
+ )
});
}
if property.writable {
v.push(TypeStruct {
parent,
- ..TypeStruct::new(SType::Fn, &format!("set_property_{}", name_for_func))
+ ..TypeStruct::new(
+ SType::Fn,
+ &setter_name.unwrap_or_else(|| format!("set_{}", &name_for_func)),
+ )
});
}
