diff options
author | Raul Santos <raulsntos@gmail.com> | 2024-04-21 05:32:47 +0200 |
---|---|---|
committer | Raul Santos <raulsntos@gmail.com> | 2024-04-21 05:32:47 +0200 |
commit | 7316918a0f546f9fa406fd65b9a70161169426a8 (patch) | |
tree | 2ad762fe718cbc94cc44755dbf8a6b2ef6e53c6f /modules/mono/csharp_script.cpp | |
parent | 2efbc6bfb3b4f49a6bc75b3d367cfe81eeddbf3a (diff) | |
download | redot-engine-7316918a0f546f9fa406fd65b9a70161169426a8.tar.gz |
C#: Don't return MethodInfo for overloaded methods
This means the GDScript analyzer loses the method signature information so it can't do type checking for the parameters.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index a3464ccfc2..d126ff60ad 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2518,13 +2518,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) { |