Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unity resolvers (part 1) #106

Merged
merged 9 commits into from
Oct 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add matrix formatters
hadashiA committed Oct 22, 2024

Verified

This commit was signed with the committer’s verified signature.
commit 4fe25bc66edb6a2e4c61e377ed4f1ddc9277c85f
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@ public class StandardResolver : IYamlFormatterResolver
{
BuiltinResolver.Instance,
GeneratedResolver.Instance,
#if UNITY_2018_3_OR_NEWER
UnityResolver.Instance,
#endif
};

static class FormatterCache<T>
Original file line number Diff line number Diff line change
@@ -336,10 +336,10 @@ public class Matrix4x4Formatter : IYamlFormatter<Matrix4x4>
public void Serialize(ref Utf8YamlEmitter emitter, Matrix4x4 value, YamlSerializationContext context)
{
emitter.BeginSequence();
Vector4Formatter.Instance.Serialize(ref emitter, value.GetColumn(0), context);
Vector4Formatter.Instance.Serialize(ref emitter, value.GetColumn(1), context);
Vector4Formatter.Instance.Serialize(ref emitter, value.GetColumn(2), context);
Vector4Formatter.Instance.Serialize(ref emitter, value.GetColumn(3), context);
Vector4Formatter.Instance.Serialize(ref emitter, value.GetRow(0), context);
Vector4Formatter.Instance.Serialize(ref emitter, value.GetRow(1), context);
Vector4Formatter.Instance.Serialize(ref emitter, value.GetRow(2), context);
Vector4Formatter.Instance.Serialize(ref emitter, value.GetRow(3), context);
emitter.EndSequence();
}

@@ -352,13 +352,18 @@ public Matrix4x4 Deserialize(ref YamlParser parser, YamlDeserializationContext c
}

parser.ReadWithVerify(ParseEventType.SequenceStart);
var col0 = Vector4Formatter.Instance.Deserialize(ref parser, context);
var col1 = Vector4Formatter.Instance.Deserialize(ref parser, context);
var col2 = Vector4Formatter.Instance.Deserialize(ref parser, context);
var col3 = Vector4Formatter.Instance.Deserialize(ref parser, context);
var row0 = Vector4Formatter.Instance.Deserialize(ref parser, context);
var row1 = Vector4Formatter.Instance.Deserialize(ref parser, context);
var row2 = Vector4Formatter.Instance.Deserialize(ref parser, context);
var row3 = Vector4Formatter.Instance.Deserialize(ref parser, context);
parser.ReadWithVerify(ParseEventType.SequenceEnd);

return new Matrix4x4(col0, col1, col2, col3);
var result = new Matrix4x4();
result.SetRow(0, row0);
result.SetRow(2, row1);
result.SetRow(3, row2);
result.SetRow(4, row3);
return result;
}
}
}

Large diffs are not rendered by default.

257 changes: 128 additions & 129 deletions VYaml.Unity/Assets/VYaml/Runtime/Serialization/Unity/UnityResolver.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using Unity.Collections;
#if VYAML_UNITY_MATHEMATICS_INTEGRATION
using Unity.Mathematics;
#endif

namespace VYaml.Serialization.Unity
namespace VYaml.Serialization
{
public class UnityResolver : IYamlFormatterResolver
{
@@ -65,133 +64,133 @@ public class UnityResolver : IYamlFormatterResolver
typeof(quaternion?),
new StaticNullableFormatter<quaternion>(UnityMathQuaternionFormatter.Instance)
},
// { typeof(bool2), Bool2Formatter.Instance },
// { typeof(bool2?), new StaticNullableFormatter<bool2>(Bool2Formatter.Instance) },
// { typeof(bool3), Bool3Formatter.Instance },
// { typeof(bool3?), new StaticNullableFormatter<bool3>(Bool3Formatter.Instance) },
// { typeof(bool4), Bool4Formatter.Instance },
// { typeof(bool4?), new StaticNullableFormatter<bool4>(Bool4Formatter.Instance) },
// { typeof(double2), Double2Formatter.Instance },
// { typeof(double2?), new StaticNullableFormatter<double2>(Double2Formatter.Instance) },
// { typeof(double3), Double3Formatter.Instance },
// { typeof(double3?), new StaticNullableFormatter<double3>(Double3Formatter.Instance) },
// { typeof(double4), Double4Formatter.Instance },
// { typeof(double4?), new StaticNullableFormatter<double4>(Double4Formatter.Instance) },
// { typeof(float2), Float2Formatter.Instance },
// { typeof(float2?), new StaticNullableFormatter<float2>(Float2Formatter.Instance) },
// { typeof(float3), Float3Formatter.Instance },
// { typeof(float3?), new StaticNullableFormatter<float3>(Float3Formatter.Instance) },
// { typeof(float4), Float4Formatter.Instance },
// { typeof(float4?), new StaticNullableFormatter<float4>(Float4Formatter.Instance) },
// { typeof(half2), Half2Formatter.Instance },
// { typeof(half2?), new StaticNullableFormatter<half2>(Half2Formatter.Instance) },
// { typeof(half3), Half3Formatter.Instance },
// { typeof(half3?), new StaticNullableFormatter<half3>(Half3Formatter.Instance) },
// { typeof(half4), Half4Formatter.Instance },
// { typeof(half4?), new StaticNullableFormatter<half4>(Half4Formatter.Instance) },
// { typeof(int2), Int2Formatter.Instance },
// { typeof(int2?), new StaticNullableFormatter<int2>(Int2Formatter.Instance) },
// { typeof(int3), Int3Formatter.Instance },
// { typeof(int3?), new StaticNullableFormatter<int3>(Int3Formatter.Instance) },
// { typeof(int4), Int4Formatter.Instance },
// { typeof(int4?), new StaticNullableFormatter<int4>(Int4Formatter.Instance) },
// { typeof(uint2), UInt2Formatter.Instance },
// { typeof(uint2?), new StaticNullableFormatter<uint2>(UInt2Formatter.Instance) },
// { typeof(uint3), UInt3Formatter.Instance },
// { typeof(uint3?), new StaticNullableFormatter<uint3>(UInt3Formatter.Instance) },
// { typeof(uint4), UInt4Formatter.Instance },
// { typeof(uint4?), new StaticNullableFormatter<uint4>(UInt4Formatter.Instance) },
//
// { typeof(bool2x2), Bool2x2Formatter.Instance },
// { typeof(bool2x2?), new StaticNullableFormatter<bool2x2>(Bool2x2Formatter.Instance) },
// { typeof(bool2x3), Bool2x3Formatter.Instance },
// { typeof(bool2x3?), new StaticNullableFormatter<bool2x3>(Bool2x3Formatter.Instance) },
// { typeof(bool2x4), Bool2x4Formatter.Instance },
// { typeof(bool2x4?), new StaticNullableFormatter<bool2x4>(Bool2x4Formatter.Instance) },
// { typeof(bool3x2), Bool3x2Formatter.Instance },
// { typeof(bool3x2?), new StaticNullableFormatter<bool3x2>(Bool3x2Formatter.Instance) },
// { typeof(bool3x3), Bool3x3Formatter.Instance },
// { typeof(bool3x3?), new StaticNullableFormatter<bool3x3>(Bool3x3Formatter.Instance) },
// { typeof(bool3x4), Bool3x4Formatter.Instance },
// { typeof(bool3x4?), new StaticNullableFormatter<bool3x4>(Bool3x4Formatter.Instance) },
// { typeof(bool4x2), Bool4x2Formatter.Instance },
// { typeof(bool4x2?), new StaticNullableFormatter<bool4x2>(Bool4x2Formatter.Instance) },
// { typeof(bool4x3), Bool4x3Formatter.Instance },
// { typeof(bool4x3?), new StaticNullableFormatter<bool4x3>(Bool4x3Formatter.Instance) },
// { typeof(bool4x4), Bool4x4Formatter.Instance },
// { typeof(bool4x4?), new StaticNullableFormatter<bool4x4>(Bool4x4Formatter.Instance) },
// { typeof(double2x2), Double2x2Formatter.Instance },
// { typeof(double2x2?), new StaticNullableFormatter<double2x2>(Double2x2Formatter.Instance) },
// { typeof(double2x3), Double2x3Formatter.Instance },
// { typeof(double2x3?), new StaticNullableFormatter<double2x3>(Double2x3Formatter.Instance) },
// { typeof(double2x4), Double2x4Formatter.Instance },
// { typeof(double2x4?), new StaticNullableFormatter<double2x4>(Double2x4Formatter.Instance) },
// { typeof(double3x2), Double3x2Formatter.Instance },
// { typeof(double3x2?), new StaticNullableFormatter<double3x2>(Double3x2Formatter.Instance) },
// { typeof(double3x3), Double3x3Formatter.Instance },
// { typeof(double3x3?), new StaticNullableFormatter<double3x3>(Double3x3Formatter.Instance) },
// { typeof(double3x4), Double3x4Formatter.Instance },
// { typeof(double3x4?), new StaticNullableFormatter<double3x4>(Double3x4Formatter.Instance) },
// { typeof(double4x2), Double4x2Formatter.Instance },
// { typeof(double4x2?), new StaticNullableFormatter<double4x2>(Double4x2Formatter.Instance) },
// { typeof(double4x3), Double4x3Formatter.Instance },
// { typeof(double4x3?), new StaticNullableFormatter<double4x3>(Double4x3Formatter.Instance) },
// { typeof(double4x4), Double4x4Formatter.Instance },
// { typeof(double4x4?), new StaticNullableFormatter<double4x4>(Double4x4Formatter.Instance) },
// { typeof(float2x2), Float2x2Formatter.Instance },
// { typeof(float2x2?), new StaticNullableFormatter<float2x2>(Float2x2Formatter.Instance) },
// { typeof(float2x3), Float2x3Formatter.Instance },
// { typeof(float2x3?), new StaticNullableFormatter<float2x3>(Float2x3Formatter.Instance) },
// { typeof(float2x4), Float2x4Formatter.Instance },
// { typeof(float2x4?), new StaticNullableFormatter<float2x4>(Float2x4Formatter.Instance) },
// { typeof(float3x2), Float3x2Formatter.Instance },
// { typeof(float3x2?), new StaticNullableFormatter<float3x2>(Float3x2Formatter.Instance) },
// { typeof(float3x3), Float3x3Formatter.Instance },
// { typeof(float3x3?), new StaticNullableFormatter<float3x3>(Float3x3Formatter.Instance) },
// { typeof(float3x4), Float3x4Formatter.Instance },
// { typeof(float3x4?), new StaticNullableFormatter<float3x4>(Float3x4Formatter.Instance) },
// { typeof(float4x2), Float4x2Formatter.Instance },
// { typeof(float4x2?), new StaticNullableFormatter<float4x2>(Float4x2Formatter.Instance) },
// { typeof(float4x3), Float4x3Formatter.Instance },
// { typeof(float4x3?), new StaticNullableFormatter<float4x3>(Float4x3Formatter.Instance) },
// { typeof(float4x4), Float4x4Formatter.Instance },
// { typeof(float4x4?), new StaticNullableFormatter<float4x4>(Float4x4Formatter.Instance) },
// { typeof(int2x2), Int2x2Formatter.Instance },
// { typeof(int2x2?), new StaticNullableFormatter<int2x2>(Int2x2Formatter.Instance) },
// { typeof(int2x3), Int2x3Formatter.Instance },
// { typeof(int2x3?), new StaticNullableFormatter<int2x3>(Int2x3Formatter.Instance) },
// { typeof(int2x4), Int2x4Formatter.Instance },
// { typeof(int2x4?), new StaticNullableFormatter<int2x4>(Int2x4Formatter.Instance) },
// { typeof(int3x2), Int3x2Formatter.Instance },
// { typeof(int3x2?), new StaticNullableFormatter<int3x2>(Int3x2Formatter.Instance) },
// { typeof(int3x3), Int3x3Formatter.Instance },
// { typeof(int3x3?), new StaticNullableFormatter<int3x3>(Int3x3Formatter.Instance) },
// { typeof(int3x4), Int3x4Formatter.Instance },
// { typeof(int3x4?), new StaticNullableFormatter<int3x4>(Int3x4Formatter.Instance) },
// { typeof(int4x2), Int4x2Formatter.Instance },
// { typeof(int4x2?), new StaticNullableFormatter<int4x2>(Int4x2Formatter.Instance) },
// { typeof(int4x3), Int4x3Formatter.Instance },
// { typeof(int4x3?), new StaticNullableFormatter<int4x3>(Int4x3Formatter.Instance) },
// { typeof(int4x4), Int4x4Formatter.Instance },
// { typeof(int4x4?), new StaticNullableFormatter<int4x4>(Int4x4Formatter.Instance) },
// { typeof(uint2x2), UInt2x2Formatter.Instance },
// { typeof(uint2x2?), new StaticNullableFormatter<uint2x2>(UInt2x2Formatter.Instance) },
// { typeof(uint2x3), UInt2x3Formatter.Instance },
// { typeof(uint2x3?), new StaticNullableFormatter<uint2x3>(UInt2x3Formatter.Instance) },
// { typeof(uint2x4), UInt2x4Formatter.Instance },
// { typeof(uint2x4?), new StaticNullableFormatter<uint2x4>(UInt2x4Formatter.Instance) },
// { typeof(uint3x2), UInt3x2Formatter.Instance },
// { typeof(uint3x2?), new StaticNullableFormatter<uint3x2>(UInt3x2Formatter.Instance) },
// { typeof(uint3x3), UInt3x3Formatter.Instance },
// { typeof(uint3x3?), new StaticNullableFormatter<uint3x3>(UInt3x3Formatter.Instance) },
// { typeof(uint3x4), UInt3x4Formatter.Instance },
// { typeof(uint3x4?), new StaticNullableFormatter<uint3x4>(UInt3x4Formatter.Instance) },
// { typeof(uint4x2), UInt4x2Formatter.Instance },
// { typeof(uint4x2?), new StaticNullableFormatter<uint4x2>(UInt4x2Formatter.Instance) },
// { typeof(uint4x3), UInt4x3Formatter.Instance },
// { typeof(uint4x3?), new StaticNullableFormatter<uint4x3>(UInt4x3Formatter.Instance) },
// { typeof(uint4x4), UInt4x4Formatter.Instance },
// { typeof(uint4x4?), new StaticNullableFormatter<uint4x4>(UInt4x4Formatter.Instance) },
{ typeof(bool2), Bool2Formatter.Instance },
{ typeof(bool2?), new StaticNullableFormatter<bool2>(Bool2Formatter.Instance) },
{ typeof(bool3), Bool3Formatter.Instance },
{ typeof(bool3?), new StaticNullableFormatter<bool3>(Bool3Formatter.Instance) },
{ typeof(bool4), Bool4Formatter.Instance },
{ typeof(bool4?), new StaticNullableFormatter<bool4>(Bool4Formatter.Instance) },
{ typeof(double2), Double2Formatter.Instance },
{ typeof(double2?), new StaticNullableFormatter<double2>(Double2Formatter.Instance) },
{ typeof(double3), Double3Formatter.Instance },
{ typeof(double3?), new StaticNullableFormatter<double3>(Double3Formatter.Instance) },
{ typeof(double4), Double4Formatter.Instance },
{ typeof(double4?), new StaticNullableFormatter<double4>(Double4Formatter.Instance) },
{ typeof(float2), Float2Formatter.Instance },
{ typeof(float2?), new StaticNullableFormatter<float2>(Float2Formatter.Instance) },
{ typeof(float3), Float3Formatter.Instance },
{ typeof(float3?), new StaticNullableFormatter<float3>(Float3Formatter.Instance) },
{ typeof(float4), Float4Formatter.Instance },
{ typeof(float4?), new StaticNullableFormatter<float4>(Float4Formatter.Instance) },
{ typeof(half2), Half2Formatter.Instance },
{ typeof(half2?), new StaticNullableFormatter<half2>(Half2Formatter.Instance) },
{ typeof(half3), Half3Formatter.Instance },
{ typeof(half3?), new StaticNullableFormatter<half3>(Half3Formatter.Instance) },
{ typeof(half4), Half4Formatter.Instance },
{ typeof(half4?), new StaticNullableFormatter<half4>(Half4Formatter.Instance) },
{ typeof(int2), Int2Formatter.Instance },
{ typeof(int2?), new StaticNullableFormatter<int2>(Int2Formatter.Instance) },
{ typeof(int3), Int3Formatter.Instance },
{ typeof(int3?), new StaticNullableFormatter<int3>(Int3Formatter.Instance) },
{ typeof(int4), Int4Formatter.Instance },
{ typeof(int4?), new StaticNullableFormatter<int4>(Int4Formatter.Instance) },
{ typeof(uint2), UInt2Formatter.Instance },
{ typeof(uint2?), new StaticNullableFormatter<uint2>(UInt2Formatter.Instance) },
{ typeof(uint3), UInt3Formatter.Instance },
{ typeof(uint3?), new StaticNullableFormatter<uint3>(UInt3Formatter.Instance) },
{ typeof(uint4), UInt4Formatter.Instance },
{ typeof(uint4?), new StaticNullableFormatter<uint4>(UInt4Formatter.Instance) },

{ typeof(bool2x2), Bool2x2Formatter.Instance },
{ typeof(bool2x2?), new StaticNullableFormatter<bool2x2>(Bool2x2Formatter.Instance) },
{ typeof(bool2x3), Bool2x3Formatter.Instance },
{ typeof(bool2x3?), new StaticNullableFormatter<bool2x3>(Bool2x3Formatter.Instance) },
{ typeof(bool2x4), Bool2x4Formatter.Instance },
{ typeof(bool2x4?), new StaticNullableFormatter<bool2x4>(Bool2x4Formatter.Instance) },
{ typeof(bool3x2), Bool3x2Formatter.Instance },
{ typeof(bool3x2?), new StaticNullableFormatter<bool3x2>(Bool3x2Formatter.Instance) },
{ typeof(bool3x3), Bool3x3Formatter.Instance },
{ typeof(bool3x3?), new StaticNullableFormatter<bool3x3>(Bool3x3Formatter.Instance) },
{ typeof(bool3x4), Bool3x4Formatter.Instance },
{ typeof(bool3x4?), new StaticNullableFormatter<bool3x4>(Bool3x4Formatter.Instance) },
{ typeof(bool4x2), Bool4x2Formatter.Instance },
{ typeof(bool4x2?), new StaticNullableFormatter<bool4x2>(Bool4x2Formatter.Instance) },
{ typeof(bool4x3), Bool4x3Formatter.Instance },
{ typeof(bool4x3?), new StaticNullableFormatter<bool4x3>(Bool4x3Formatter.Instance) },
{ typeof(bool4x4), Bool4x4Formatter.Instance },
{ typeof(bool4x4?), new StaticNullableFormatter<bool4x4>(Bool4x4Formatter.Instance) },
{ typeof(double2x2), Double2x2Formatter.Instance },
{ typeof(double2x2?), new StaticNullableFormatter<double2x2>(Double2x2Formatter.Instance) },
{ typeof(double2x3), Double2x3Formatter.Instance },
{ typeof(double2x3?), new StaticNullableFormatter<double2x3>(Double2x3Formatter.Instance) },
{ typeof(double2x4), Double2x4Formatter.Instance },
{ typeof(double2x4?), new StaticNullableFormatter<double2x4>(Double2x4Formatter.Instance) },
{ typeof(double3x2), Double3x2Formatter.Instance },
{ typeof(double3x2?), new StaticNullableFormatter<double3x2>(Double3x2Formatter.Instance) },
{ typeof(double3x3), Double3x3Formatter.Instance },
{ typeof(double3x3?), new StaticNullableFormatter<double3x3>(Double3x3Formatter.Instance) },
{ typeof(double3x4), Double3x4Formatter.Instance },
{ typeof(double3x4?), new StaticNullableFormatter<double3x4>(Double3x4Formatter.Instance) },
{ typeof(double4x2), Double4x2Formatter.Instance },
{ typeof(double4x2?), new StaticNullableFormatter<double4x2>(Double4x2Formatter.Instance) },
{ typeof(double4x3), Double4x3Formatter.Instance },
{ typeof(double4x3?), new StaticNullableFormatter<double4x3>(Double4x3Formatter.Instance) },
{ typeof(double4x4), Double4x4Formatter.Instance },
{ typeof(double4x4?), new StaticNullableFormatter<double4x4>(Double4x4Formatter.Instance) },
{ typeof(float2x2), Float2x2Formatter.Instance },
{ typeof(float2x2?), new StaticNullableFormatter<float2x2>(Float2x2Formatter.Instance) },
{ typeof(float2x3), Float2x3Formatter.Instance },
{ typeof(float2x3?), new StaticNullableFormatter<float2x3>(Float2x3Formatter.Instance) },
{ typeof(float2x4), Float2x4Formatter.Instance },
{ typeof(float2x4?), new StaticNullableFormatter<float2x4>(Float2x4Formatter.Instance) },
{ typeof(float3x2), Float3x2Formatter.Instance },
{ typeof(float3x2?), new StaticNullableFormatter<float3x2>(Float3x2Formatter.Instance) },
{ typeof(float3x3), Float3x3Formatter.Instance },
{ typeof(float3x3?), new StaticNullableFormatter<float3x3>(Float3x3Formatter.Instance) },
{ typeof(float3x4), Float3x4Formatter.Instance },
{ typeof(float3x4?), new StaticNullableFormatter<float3x4>(Float3x4Formatter.Instance) },
{ typeof(float4x2), Float4x2Formatter.Instance },
{ typeof(float4x2?), new StaticNullableFormatter<float4x2>(Float4x2Formatter.Instance) },
{ typeof(float4x3), Float4x3Formatter.Instance },
{ typeof(float4x3?), new StaticNullableFormatter<float4x3>(Float4x3Formatter.Instance) },
{ typeof(float4x4), Float4x4Formatter.Instance },
{ typeof(float4x4?), new StaticNullableFormatter<float4x4>(Float4x4Formatter.Instance) },
{ typeof(int2x2), Int2x2Formatter.Instance },
{ typeof(int2x2?), new StaticNullableFormatter<int2x2>(Int2x2Formatter.Instance) },
{ typeof(int2x3), Int2x3Formatter.Instance },
{ typeof(int2x3?), new StaticNullableFormatter<int2x3>(Int2x3Formatter.Instance) },
{ typeof(int2x4), Int2x4Formatter.Instance },
{ typeof(int2x4?), new StaticNullableFormatter<int2x4>(Int2x4Formatter.Instance) },
{ typeof(int3x2), Int3x2Formatter.Instance },
{ typeof(int3x2?), new StaticNullableFormatter<int3x2>(Int3x2Formatter.Instance) },
{ typeof(int3x3), Int3x3Formatter.Instance },
{ typeof(int3x3?), new StaticNullableFormatter<int3x3>(Int3x3Formatter.Instance) },
{ typeof(int3x4), Int3x4Formatter.Instance },
{ typeof(int3x4?), new StaticNullableFormatter<int3x4>(Int3x4Formatter.Instance) },
{ typeof(int4x2), Int4x2Formatter.Instance },
{ typeof(int4x2?), new StaticNullableFormatter<int4x2>(Int4x2Formatter.Instance) },
{ typeof(int4x3), Int4x3Formatter.Instance },
{ typeof(int4x3?), new StaticNullableFormatter<int4x3>(Int4x3Formatter.Instance) },
{ typeof(int4x4), Int4x4Formatter.Instance },
{ typeof(int4x4?), new StaticNullableFormatter<int4x4>(Int4x4Formatter.Instance) },
{ typeof(uint2x2), UInt2x2Formatter.Instance },
{ typeof(uint2x2?), new StaticNullableFormatter<uint2x2>(UInt2x2Formatter.Instance) },
{ typeof(uint2x3), UInt2x3Formatter.Instance },
{ typeof(uint2x3?), new StaticNullableFormatter<uint2x3>(UInt2x3Formatter.Instance) },
{ typeof(uint2x4), UInt2x4Formatter.Instance },
{ typeof(uint2x4?), new StaticNullableFormatter<uint2x4>(UInt2x4Formatter.Instance) },
{ typeof(uint3x2), UInt3x2Formatter.Instance },
{ typeof(uint3x2?), new StaticNullableFormatter<uint3x2>(UInt3x2Formatter.Instance) },
{ typeof(uint3x3), UInt3x3Formatter.Instance },
{ typeof(uint3x3?), new StaticNullableFormatter<uint3x3>(UInt3x3Formatter.Instance) },
{ typeof(uint3x4), UInt3x4Formatter.Instance },
{ typeof(uint3x4?), new StaticNullableFormatter<uint3x4>(UInt3x4Formatter.Instance) },
{ typeof(uint4x2), UInt4x2Formatter.Instance },
{ typeof(uint4x2?), new StaticNullableFormatter<uint4x2>(UInt4x2Formatter.Instance) },
{ typeof(uint4x3), UInt4x3Formatter.Instance },
{ typeof(uint4x3?), new StaticNullableFormatter<uint4x3>(UInt4x3Formatter.Instance) },
{ typeof(uint4x4), UInt4x4Formatter.Instance },
{ typeof(uint4x4?), new StaticNullableFormatter<uint4x4>(UInt4x4Formatter.Instance) },
#endif
};


Unchanged files with check annotations Beta

}
else
{
targets.Append(container);

Check warning on line 59 in VYaml.SourceGenerator/Shims/CSharpSyntaxHelper.cs

GitHub Actions / test-dotnet

Possible null reference argument for parameter 'item' in 'void ValueListBuilder<SyntaxNode>.Append(SyntaxNode item)'.
}
}
break;
case ParseEventType.MappingStart:
{
var dict = new Dictionary<object?, object?>();

Check warning on line 169 in VYaml/Serialization/Formatters/PrimitiveObjectFormatter.cs

GitHub Actions / test-dotnet

The type 'object?' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'object?' doesn't match 'notnull' constraint.

Check warning on line 169 in VYaml/Serialization/Formatters/PrimitiveObjectFormatter.cs

GitHub Actions / test-dotnet

The type 'object?' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'object?' doesn't match 'notnull' constraint.
parser.Read();
while (!parser.End && parser.CurrentEventType != ParseEventType.MappingEnd)
{
while (!mutator.TryMutate(source.AsSpan(), destination, out var written))
{
// ReSharper disable once StackAllocInsideLoop
destination = stackalloc char[destination.Length * 2];

Check warning on line 78 in VYaml/Serialization/NamingConventionMutator.cs

GitHub Actions / test-dotnet

Potential stack overflow. Move the stackalloc out of the loop. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014)

Check warning on line 78 in VYaml/Serialization/NamingConventionMutator.cs

GitHub Actions / test-dotnet

Potential stack overflow. Move the stackalloc out of the loop. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014)
}
return destination.ToString();
}
while (!mutator.TryMutate(name.AsSpan(), destination, out written))
{
// ReSharper disable once StackAllocInsideLoop
destination = stackalloc char[destination.Length * 2];

Check warning on line 42 in VYaml/Serialization/Formatters/EnumAsStringFormatter.cs

GitHub Actions / test-dotnet

Potential stack overflow. Move the stackalloc out of the loop. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014)
}
emitter.WriteString(destination[..written].ToString());
{
var mutator = NamingConventionMutator.Of(NamingConventionByType ?? YamlSerializerOptions.DefaultNamingConvention);
var name = Enum.GetName(type, value)!;
Span<char> destination = stackalloc char[name.Length];

Check warning on line 97 in VYaml/Serialization/Formatters/EnumAsStringFormatter.cs

GitHub Actions / test-dotnet

Potential stack overflow. Move the stackalloc out of the loop. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014)
int written;
while (!mutator.TryMutate(name.AsSpan(), destination, out written))
{
// ReSharper disable once StackAllocInsideLoop
destination = stackalloc char[destination.Length * 2];

Check warning on line 102 in VYaml/Serialization/Formatters/EnumAsStringFormatter.cs

GitHub Actions / test-dotnet

Potential stack overflow. Move the stackalloc out of the loop. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014)
}
var stringValue = destination[..written].ToString();
while (!mutator.TryMutate(stringValue.AsSpan(), buffer, out bytesWritten))
{
// ReSharper disable once StackAllocInsideLoop
buffer = stackalloc char[buffer.Length * 2];

Check warning on line 134 in VYaml/Serialization/Formatters/EnumAsStringFormatter.cs

GitHub Actions / test-dotnet

Potential stack overflow. Move the stackalloc out of the loop. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014)
}
unsafe
while (!mutator.TryMutate(scalar, buffer, out bytesWritten))
{
// ReSharper disable once StackAllocInsideLoop
buffer = stackalloc char[buffer.Length * 2];

Check warning on line 167 in VYaml/Serialization/Formatters/EnumAsStringFormatter.cs

GitHub Actions / test-dotnet

Potential stack overflow. Move the stackalloc out of the loop. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014)
}
var mutatedScalar = buffer[..bytesWritten].ToString();