Skip to content

Commit

Permalink
Merge pull request #77904 from raulsntos/dotnet/obsolete-deprecated-m…
Browse files Browse the repository at this point in the history
…embers

C#: Add `[Obsolete]` attribute to deprecated members
  • Loading branch information
akien-mga committed Jun 6, 2023
2 parents 2a1bc05 + 0484993 commit 0a0132c
Showing 1 changed file with 24 additions and 0 deletions.
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

0 comments on commit 0a0132c

Please sign in to comment.