You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-06 17:25:19 +00:00
Move to .NET8
- Change TFM and LangVersion - Better exception throwing (CA1510, CA1512, CA1513) - Better exception utility method definition (CA1859) - Prefer comparing `.Count` over calling `.Any()` (CA1860) - Prefer `.AsSpan()` over `.Substring()` (CA1846) - Add a few more `scoped` - Use `RuntimeHelpers.GetUninitializedObject()` instead of `FormatterServices.GetUninitializedObject()` - Use delegate instead of delegate pointer in variant generic conversions - Enable EnforceExtendedAnalyzerRules in source generator projects - Disable CS8981 on structs named movable in Godot.NativeInterop
This commit is contained in:
@@ -172,7 +172,11 @@ using Godot.NativeInterop;
|
||||
{
|
||||
var parameter = callback.Parameters[i];
|
||||
|
||||
source.Append(parameter.DeclaringSyntaxReferences[0].GetSyntax().ToString());
|
||||
AppendRefKind(source, parameter.RefKind, parameter.ScopedKind);
|
||||
source.Append(' ');
|
||||
source.Append(parameter.Type.FullQualifiedNameIncludeGlobal());
|
||||
source.Append(' ');
|
||||
source.Append(parameter.Name);
|
||||
|
||||
if (parameter.RefKind == RefKind.Out)
|
||||
{
|
||||
@@ -204,7 +208,7 @@ using Godot.NativeInterop;
|
||||
{
|
||||
// If it's a by-ref param and we can't get the pointer
|
||||
// just pass it by-ref and let it be pinned.
|
||||
AppendRefKind(methodCallArguments, parameter.RefKind)
|
||||
AppendRefKind(methodCallArguments, parameter.RefKind, parameter.ScopedKind)
|
||||
.Append(' ')
|
||||
.Append(parameter.Name);
|
||||
}
|
||||
@@ -342,7 +346,7 @@ using Godot.NativeInterop;
|
||||
{
|
||||
// If it's a by-ref param and we can't get the pointer
|
||||
// just pass it by-ref and let it be pinned.
|
||||
AppendRefKind(source, parameter.RefKind)
|
||||
AppendRefKind(source, parameter.RefKind, parameter.ScopedKind)
|
||||
.Append(' ')
|
||||
.Append(parameter.Type.FullQualifiedNameIncludeGlobal());
|
||||
}
|
||||
@@ -388,14 +392,18 @@ using Godot.NativeInterop;
|
||||
private static bool IsByRefParameter(IParameterSymbol parameter) =>
|
||||
parameter.RefKind is RefKind.In or RefKind.Out or RefKind.Ref;
|
||||
|
||||
private static StringBuilder AppendRefKind(StringBuilder source, RefKind refKind) =>
|
||||
refKind switch
|
||||
private static StringBuilder AppendRefKind(StringBuilder source, RefKind refKind, ScopedKind scopedKind)
|
||||
{
|
||||
return (refKind, scopedKind) switch
|
||||
{
|
||||
RefKind.In => source.Append("in"),
|
||||
RefKind.Out => source.Append("out"),
|
||||
RefKind.Ref => source.Append("ref"),
|
||||
(RefKind.Out, _) => source.Append("out"),
|
||||
(RefKind.In, ScopedKind.ScopedRef) => source.Append("scoped in"),
|
||||
(RefKind.In, _) => source.Append("in"),
|
||||
(RefKind.Ref, ScopedKind.ScopedRef) => source.Append("scoped ref"),
|
||||
(RefKind.Ref, _) => source.Append("ref"),
|
||||
_ => source,
|
||||
};
|
||||
}
|
||||
|
||||
private static void AppendPointerType(StringBuilder source, ITypeSymbol type)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user