diff options
author | Raul Santos <raulsntos@gmail.com> | 2021-12-02 20:05:05 +0100 |
---|---|---|
committer | Raul Santos <raulsntos@gmail.com> | 2021-12-04 02:54:33 +0100 |
commit | d28be4d5808947606b8189ae1b2900b8fd2925cf (patch) | |
tree | 1878429ad479a4eabad5bfd4b4a0b95a70eaa94a /modules/mono/glue | |
parent | 892a5a72cd9b25dc660671b9f4244fd842884b9f (diff) |
Fix get_all_delegates method for generic classes
If the class is generic, we must get its generic type definition and use
it to retrieve the delegates.
Diffstat (limited to 'modules/mono/glue')
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs index 3051bcedc7..ee4d0eed08 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs @@ -80,6 +80,18 @@ namespace Godot private static bool TypeIsGenericIDictionary(Type type) => type.GetGenericTypeDefinition() == typeof(IDictionary<,>); /// <summary> + /// Returns the generic type definition of <paramref name="type"/>. + /// </summary> + /// <exception cref="InvalidOperationException"> + /// Thrown when the given <paramref name="type"/> is not a generic type. + /// That is, <see cref="Type.IsGenericType"/> returns <see langword="false"/>. + /// </exception> + private static void GetGenericTypeDefinition(Type type, out Type genericTypeDefinition) + { + genericTypeDefinition = type.GetGenericTypeDefinition(); + } + + /// <summary> /// Gets the element type for the given <paramref name="arrayType"/>. /// </summary> /// <param name="arrayType">Type for the generic array.</param> |