diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/Lightup/TypeDeclarationSyntaxExtensions.cs b/StyleCop.Analyzers/StyleCop.Analyzers/Lightup/TypeDeclarationSyntaxExtensions.cs new file mode 100644 index 000000000..64140adb3 --- /dev/null +++ b/StyleCop.Analyzers/StyleCop.Analyzers/Lightup/TypeDeclarationSyntaxExtensions.cs @@ -0,0 +1,29 @@ +// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace StyleCop.Analyzers.Lightup; + +using System; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +internal static class TypeDeclarationSyntaxExtensions +{ + private static readonly Func ParameterListAccessor; + private static readonly Func WithParameterListAccessor; + + static TypeDeclarationSyntaxExtensions() + { + ParameterListAccessor = LightupHelpers.CreateSyntaxPropertyAccessor(typeof(TypeDeclarationSyntax), nameof(ParameterList)); + WithParameterListAccessor = LightupHelpers.CreateSyntaxWithPropertyAccessor(typeof(TypeDeclarationSyntax), nameof(ParameterList)); + } + + public static ParameterListSyntax? ParameterList(this TypeDeclarationSyntax syntax) + { + return ParameterListAccessor(syntax); + } + + public static TypeDeclarationSyntax WithParameterList(this TypeDeclarationSyntax syntax, ParameterListSyntax? parameterList) + { + return WithParameterListAccessor(syntax, parameterList); + } +}