diff options
author | Ignacio Roldán Etcheverry <ignalfonsore@gmail.com> | 2022-02-27 21:57:46 +0100 |
---|---|---|
committer | Ignacio Roldán Etcheverry <ignalfonsore@gmail.com> | 2022-08-22 03:36:51 +0200 |
commit | e22dd3bc6a0934d26ba5c406505b2c60c43445fd (patch) | |
tree | 160b738f2a7bb1466177fe8c3184456221d65a67 /modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs | |
parent | 778007a358961f30ccadd738300a353edf0a0c51 (diff) | |
download | redot-engine-e22dd3bc6a0934d26ba5c406505b2c60c43445fd.tar.gz |
C#: Static marshaling for bindings and source generators
Previously, we added source generators for invoking/accessing methods,
properties and fields in scripts. This freed us from the overhead of
reflection. However, the generated code still used our dynamic
marshaling functions, which do runtime type checking and box value
types.
This commit changes the bindings and source generators to include
'static' marshaling. Based on the types known at compile time, now
we generate the appropriate marshaling call for each type.
Diffstat (limited to 'modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs')
-rw-r--r-- | modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs index 2179aeea88..4ac7274e41 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -190,6 +190,7 @@ namespace Godot.SourceGenerators if (method.IsGenericMethod) continue; + var retSymbol = method.ReturnType; var retType = method.ReturnsVoid ? null : MarshalUtils.ConvertManagedTypeToMarshalType(method.ReturnType, typeCache); @@ -212,7 +213,7 @@ namespace Godot.SourceGenerators continue; yield return new GodotMethodData(method, paramTypes, parameters - .Select(p => p.Type).ToImmutableArray(), retType); + .Select(p => p.Type).ToImmutableArray(), retType, retSymbol); } } |