mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
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.
This commit is contained in:
parent
778007a358
commit
e22dd3bc6a
14 changed files with 1009 additions and 356 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue