From d4880b3c235f95b6fb9e090f94c18109ff757e0b Mon Sep 17 00:00:00 2001 From: CDnX Date: Mon, 5 Feb 2024 13:18:58 +0900 Subject: [PATCH] remove Attributes from ParameterData Unlike my assumption, adding Attribute at both definition and implementation results in duplicate Attribute. This commit will fix it. --- .../SinteredMethodGenerator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Devris.LibDevris.MethodSinter.Generator/SinteredMethodGenerator.cs b/Devris.LibDevris.MethodSinter.Generator/SinteredMethodGenerator.cs index 1af1b3d..221c798 100644 --- a/Devris.LibDevris.MethodSinter.Generator/SinteredMethodGenerator.cs +++ b/Devris.LibDevris.MethodSinter.Generator/SinteredMethodGenerator.cs @@ -33,7 +33,6 @@ public void Initialize(IncrementalGeneratorInitializationContext context) Parameters = ((MethodDeclarationSyntax)gac.TargetNode).ParameterList.Parameters .Select(p => new SinteredMethodData.MethodData.ParameterData { - Attributes = p.AttributeLists.ToString(), Modifier = p.Modifiers.ToString(), Type = p.Type.ToString(), ParameterName = p.Identifier.Text @@ -114,8 +113,6 @@ public struct MethodData public IEnumerable Parameters { get; set; } public struct ParameterData { - public string Attributes { get; set; } - public string Modifier { get; set; } public string Type { get; set; } @@ -124,7 +121,10 @@ public struct ParameterData public override string ToString() { - return string.Join(" ", new[] { Attributes, Modifier, Type, ParameterName }.Where(s => string.IsNullOrWhiteSpace(s) == false)); + if (string.IsNullOrWhiteSpace(Modifier)) + return $"{Type} {ParameterName}"; + + return $"{Modifier} {Type} {ParameterName}"; } } }