Added nullable annotation for all generated files

This commit is contained in:
Darth Affe 2024-07-21 21:51:43 +02:00
parent 1b929ac886
commit fed16da8ce
61 changed files with 201 additions and 55 deletions

View File

@ -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}};

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

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

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

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

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

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
[AttributeUsage(AttributeTargets.Method)]
internal class ColorSortGeneratorAttribute(string dataTypeName, string sortValueName) : Attribute

View File

@ -1,4 +1,6 @@
using System.Buffers;
#nullable enable
using System.Buffers;
namespace HPPH;

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public sealed partial class ColorFormatABGR : IColorFormat
{

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public sealed partial class ColorFormatARGB : IColorFormat
{

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public sealed partial class ColorFormatBGR : IColorFormat
{

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public sealed partial class ColorFormatBGRA : IColorFormat
{

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public sealed partial class ColorFormatRGB : IColorFormat
{

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
#nullable enable
using System.Runtime.InteropServices;
namespace HPPH;

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public sealed partial class ColorFormatRGBA : IColorFormat
{

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public partial interface IColorFormat
{

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public partial interface IColorFormat
{

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public partial interface IColorFormat
{

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public partial interface IColorFormat
{

View File

@ -1,4 +1,6 @@
namespace HPPH;
#nullable enable
namespace HPPH;
public partial interface IColorFormat
{

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
using System.Diagnostics;

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
using System.Diagnostics;

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
using System.Diagnostics;

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
using System.Diagnostics;

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
using System.Diagnostics;

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ReplaceWithPrimaryConstructorParameter
using System.Diagnostics;

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter

View File

@ -1,4 +1,6 @@
// ReSharper disable ConvertToAutoProperty
#nullable enable
// ReSharper disable ConvertToAutoProperty
// ReSharper disable ConvertToAutoPropertyWhenPossible
// ReSharper disable ReplaceWithPrimaryConstructorParameter