Skip to content

Commit

Permalink
Merge pull request #90968 from raulsntos/fix-gdscript-analyzer-with-o…
Browse files Browse the repository at this point in the history
…verloaded-dotnet-methods

C#: Don't return MethodInfo for overloaded methods
  • Loading branch information
akien-mga committed Apr 22, 2024
2 parents e7dc4b4 + 7316918 commit 2b42352
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/mono/csharp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2519,13 +2519,20 @@ MethodInfo CSharpScript::get_method_info(const StringName &p_method) const {
return MethodInfo();
}

MethodInfo mi;
for (const CSharpMethodInfo &E : methods) {
if (E.name == p_method) {
return E.method_info;
if (mi.name == p_method) {
// We already found a method with the same name before so
// that means this method has overloads, the best we can do
// is return an empty MethodInfo.
return MethodInfo();
}
mi = E.method_info;
}
}

return MethodInfo();
return mi;
}

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

0 comments on commit 2b42352

Please sign in to comment.