Skip to content

Commit 2776715

Browse files
committed
Merge pull request godotengine#101970 from raulsntos/dotnet/signal-obsolete-everything
[.NET] Add Obsolete attribute to signal trampolines and emitter functions
2 parents 0dc6b7c + 5a53ec5 commit 2776715

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

modules/mono/editor/bindings_generator.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,20 +3216,24 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
32163216
p_output.append(" class.\n");
32173217
p_output.append(INDENT1 "/// </summary>");
32183218

3219+
// Generate delegate
32193220
if (p_isignal.is_deprecated) {
32203221
p_output.append(MEMBER_BEGIN "[Obsolete(\"");
32213222
p_output.append(bbcode_to_text(p_isignal.deprecation_message, &p_itype));
32223223
p_output.append("\")]");
32233224
}
3224-
3225-
// Generate delegate
32263225
p_output.append(MEMBER_BEGIN "public delegate void ");
32273226
p_output.append(delegate_name);
32283227
p_output.append("(");
32293228
p_output.append(arguments_sig);
32303229
p_output.append(");\n");
32313230

32323231
// Generate Callable trampoline for the delegate
3232+
if (p_isignal.is_deprecated) {
3233+
p_output.append(MEMBER_BEGIN "[Obsolete(\"");
3234+
p_output.append(bbcode_to_text(p_isignal.deprecation_message, &p_itype));
3235+
p_output.append("\")]");
3236+
}
32333237
p_output << MEMBER_BEGIN "private static void " << p_isignal.proxy_name << "Trampoline"
32343238
<< "(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)\n"
32353239
<< INDENT1 "{\n"
@@ -3279,17 +3283,16 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
32793283
}
32803284
}
32813285

3282-
if (p_isignal.is_deprecated) {
3283-
p_output.append(MEMBER_BEGIN "[Obsolete(\"");
3284-
p_output.append(bbcode_to_text(p_isignal.deprecation_message, &p_itype));
3285-
p_output.append("\")]");
3286-
}
3287-
32883286
// TODO:
32893287
// Could we assume the StringName instance of signal name will never be freed (it's stored in ClassDB) before the managed world is unloaded?
32903288
// If so, we could store the pointer we get from `data_unique_pointer()` instead of allocating StringName here.
32913289

32923290
// Generate event
3291+
if (p_isignal.is_deprecated) {
3292+
p_output.append(MEMBER_BEGIN "[Obsolete(\"");
3293+
p_output.append(bbcode_to_text(p_isignal.deprecation_message, &p_itype));
3294+
p_output.append("\")]");
3295+
}
32933296
p_output.append(MEMBER_BEGIN "public ");
32943297

32953298
if (p_itype.is_singleton) {
@@ -3339,6 +3342,11 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
33393342

33403343
// Generate EmitSignal{EventName} method to raise the event.
33413344
if (!p_itype.is_singleton) {
3345+
if (p_isignal.is_deprecated) {
3346+
p_output.append(MEMBER_BEGIN "[Obsolete(\"");
3347+
p_output.append(bbcode_to_text(p_isignal.deprecation_message, &p_itype));
3348+
p_output.append("\")]");
3349+
}
33423350
p_output.append(MEMBER_BEGIN "protected void ");
33433351
p_output << "EmitSignal" << p_isignal.proxy_name;
33443352
if (is_parameterless) {

0 commit comments

Comments
 (0)