Added nullable annotation for all generated files

This commit is contained in:
DarthAffe committed 2024-07-21 21:51:43 +02:00
1 parent 1b929ac886
commit fed16da8ce
61 files changed
+201 -55

No files matched your search

@@ -15,6 +15,8 @@ public class ColorSortSourceGenerator : IIncrementalGenerator
#region Properties & Fields
private const string SORT_GENERATOR_ATTRIBUTE_SOURCE = """
#nullable enable
namespace HPPH;
[AttributeUsage(AttributeTargets.Method)]
@@ -79,6 +81,8 @@ public class ColorSortSourceGenerator : IIncrementalGenerator
foreach (KeyValuePair<(string @namespace, string @class, string classModifier), string> data in sourceMapping)
{
context.AddSource($"{data.Key.@class}.g.cs", SourceText.From($$"""
#nullable enable
using System.Buffers;
namespace {{data.Key.@namespace}};
+4
View File
@@ -18,6 +18,8 @@ internal class Average : IGeneratorFeature
private static string GenerateColorFormatAverage(ColorFormatData colorFormat)
{
return $$"""
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;
@@ -36,6 +38,8 @@ internal class Average : IGeneratorFeature
private static string GenerateColorFormatInterfaceAverage()
{
return """
#nullable enable
namespace HPPH;
public partial interface IColorFormat
+8
View File
@@ -25,6 +25,8 @@ internal class Colors : IGeneratorFeature
=> colorFormat.Bpp switch
{
3 => $$"""
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter
@@ -89,6 +91,8 @@ internal class Colors : IGeneratorFeature
""",
4 => $$"""
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter
@@ -159,6 +163,8 @@ internal class Colors : IGeneratorFeature
private static string GenerateColorFormatCode(ColorFormatData colorFormat)
{
return $$"""
#nullable enable
namespace HPPH;
public sealed partial class ColorFormat{{colorFormat.Format}} : IColorFormat
@@ -188,6 +194,8 @@ internal class Colors : IGeneratorFeature
{
StringBuilder sb = new();
sb.AppendLine("""
#nullable enable
namespace HPPH;
public partial interface IColorFormat
+8
View File
@@ -20,6 +20,8 @@ internal class MinMax : IGeneratorFeature
=> colorFormat.Bpp switch
{
3 => $$"""
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
@@ -73,6 +75,8 @@ internal class MinMax : IGeneratorFeature
""",
4 => $$"""
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
@@ -133,6 +137,8 @@ internal class MinMax : IGeneratorFeature
private static string GenerateColorFormatMinMax(ColorFormatData colorFormat)
{
return $$"""
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;
@@ -151,6 +157,8 @@ internal class MinMax : IGeneratorFeature
private static string GenerateColorFormatInterfaceMinMax()
{
return """
#nullable enable
namespace HPPH;
public partial interface IColorFormat
+4
View File
@@ -18,6 +18,8 @@ internal class Quantize : IGeneratorFeature
private static string GenerateColorFormatQuantize(ColorFormatData colorFormat)
{
return $$"""
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;
@@ -56,6 +58,8 @@ internal class Quantize : IGeneratorFeature
private static string GenerateColorFormatInterfaceQuantize()
{
return """
#nullable enable
namespace HPPH;
public partial interface IColorFormat
+8
View File
@@ -20,6 +20,8 @@ internal class Sum : IGeneratorFeature
=> colorFormat.Bpp switch
{
3 => $$"""
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter
@@ -58,6 +60,8 @@ internal class Sum : IGeneratorFeature
""",
4 => $$"""
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter
@@ -100,6 +104,8 @@ internal class Sum : IGeneratorFeature
private static string GenerateColorFormatSum(ColorFormatData colorFormat)
{
return $$"""
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;
@@ -118,6 +124,8 @@ internal class Sum : IGeneratorFeature
private static string GenerateColorFormatInterfaceSum()
{
return """
#nullable enable
namespace HPPH;
public partial interface IColorFormat