Use Utf8String directly in `fixed` statement

This commit is contained in:
Susko3 2024-04-17 13:17:09 +02:00
parent ec3ce75780
commit a6838a3f9f
3 changed files with 3 additions and 6 deletions

View File

@ -112,10 +112,7 @@ using System;
param.Identifier.ValueText + pointer_suffix)
.WithInitializer(
SyntaxFactory.EqualsValueClause(
SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
SyntaxFactory.IdentifierName(param.Identifier),
SyntaxFactory.IdentifierName(Helper.Utf8StringReadOnlySpanFieldName)))))),
SyntaxFactory.IdentifierName(param.Identifier))))),
expr);
}

View File

@ -18,8 +18,6 @@ namespace SDL3.SourceGeneration
public const string Utf8StringStructName = "Utf8String";
public const string Utf8StringReadOnlySpanFieldName = "Raw";
public static bool IsVoid(this TypeSyntax type) => type is PredefinedTypeSyntax predefined
&& predefined.Keyword.IsKind(SyntaxKind.VoidKeyword);

View File

@ -48,5 +48,7 @@ namespace SDL
return new Utf8String(raw);
}
internal ref readonly byte GetPinnableReference() => ref Raw.GetPinnableReference();
}
}