C#: Add [Obsolete] attribute to deprecated members

This commit is contained in:
Raul Santos 2023-06-06 12:08:07 +02:00
parent db5113de36
commit 0484993121
No known key found for this signature in database
GPG key ID: B532473AE3A803E4

View file

@ -1375,6 +1375,10 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.append("/// </summary>\n");
}
if (class_doc->is_deprecated) {
output.append("[Obsolete(\"This class is deprecated.\")]\n");
}
}
// We generate a `GodotClassName` attribute if the engine class name is not the same as the
@ -1426,6 +1430,10 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.append(INDENT1 "/// </summary>");
}
if (iconstant.const_doc->is_deprecated) {
output.append(MEMBER_BEGIN "[Obsolete(\"This constant is deprecated.\")]");
}
}
output.append(MEMBER_BEGIN "public const long ");
@ -1470,6 +1478,10 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.append(INDENT2 "/// </summary>\n");
}
if (iconstant.const_doc->is_deprecated) {
output.append(INDENT2 "[Obsolete(\"This enum member is deprecated.\")]\n");
}
}
output.append(INDENT2);
@ -1867,6 +1879,10 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
p_output.append(INDENT1 "/// </summary>");
}
if (p_iprop.prop_doc->is_deprecated) {
p_output.append(MEMBER_BEGIN "[Obsolete(\"This property is deprecated.\")]");
}
}
p_output.append(MEMBER_BEGIN "public ");
@ -2102,6 +2118,10 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
p_output.append(INDENT1 "/// </summary>");
}
if (p_imethod.method_doc->is_deprecated) {
p_output.append(MEMBER_BEGIN "[Obsolete(\"This method is deprecated.\")]");
}
}
if (default_args_doc.get_string_length()) {
@ -2314,6 +2334,10 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
p_output.append(INDENT1 "/// </summary>");
}
if (p_isignal.method_doc->is_deprecated) {
p_output.append(MEMBER_BEGIN "[Obsolete(\"This signal is deprecated.\")]");
}
}
if (p_isignal.is_deprecated) {