Skip to content

Commit 2b42352

Browse files
committed
Merge pull request #90968 from raulsntos/fix-gdscript-analyzer-with-overloaded-dotnet-methods
C#: Don't return MethodInfo for overloaded methods
2 parents e7dc4b4 + 7316918 commit 2b42352

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/mono/csharp_script.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,13 +2519,20 @@ MethodInfo CSharpScript::get_method_info(const StringName &p_method) const {
25192519
return MethodInfo();
25202520
}
25212521

2522+
MethodInfo mi;
25222523
for (const CSharpMethodInfo &E : methods) {
25232524
if (E.name == p_method) {
2524-
return E.method_info;
2525+
if (mi.name == p_method) {
2526+
// We already found a method with the same name before so
2527+
// that means this method has overloads, the best we can do
2528+
// is return an empty MethodInfo.
2529+
return MethodInfo();
2530+
}
2531+
mi = E.method_info;
25252532
}
25262533
}
25272534

2528-
return MethodInfo();
2535+
return mi;
25292536
}
25302537

25312538
Variant CSharpScript::callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {

0 commit comments

Comments
 (0)