Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Add [Obsolete] attribute to deprecated members #77904

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions modules/mono/editor/bindings_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 ");
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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) {
Expand Down