From f7998e462e0fa05ce3d20478a7d6629bcf2d8535 Mon Sep 17 00:00:00 2001 From: Boris Proshin Date: Wed, 18 Oct 2023 15:16:44 +0300 Subject: [PATCH] Ignore const variables in GenConstructor --- UnityAttributes/GenConstructor/GenConstructorGenerator.cs | 1 + UnityAttributes/UnityAttributes.csproj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/UnityAttributes/GenConstructor/GenConstructorGenerator.cs b/UnityAttributes/GenConstructor/GenConstructorGenerator.cs index 977a147..5ed0605 100644 --- a/UnityAttributes/GenConstructor/GenConstructorGenerator.cs +++ b/UnityAttributes/GenConstructor/GenConstructorGenerator.cs @@ -128,6 +128,7 @@ public void OnVisitSyntaxNode(GeneratorSyntaxContext context) .SelectMany(field => field.Declaration.Variables) .Select(variable => Unsafe.As(context.SemanticModel.GetDeclaredSymbol(variable))) .Where(checkForIgnoreAttribute) + .Where(variable => !variable.IsConst) .ToArray(); classes.Add((classSymbol, fields)); diff --git a/UnityAttributes/UnityAttributes.csproj b/UnityAttributes/UnityAttributes.csproj index 03a91e8..f6520b0 100644 --- a/UnityAttributes/UnityAttributes.csproj +++ b/UnityAttributes/UnityAttributes.csproj @@ -1,7 +1,7 @@ - 1.1.2.0 + 1.1.2.1 netstandard2.0 UnityAttributes latest