-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3774 from sharwell/type-extensions
Define lightup method for TypeDeclarationSyntax.ParameterList
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
StyleCop.Analyzers/StyleCop.Analyzers/Lightup/TypeDeclarationSyntaxExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<TypeDeclarationSyntax, ParameterListSyntax?> ParameterListAccessor; | ||
private static readonly Func<TypeDeclarationSyntax, ParameterListSyntax?, TypeDeclarationSyntax> WithParameterListAccessor; | ||
|
||
static TypeDeclarationSyntaxExtensions() | ||
{ | ||
ParameterListAccessor = LightupHelpers.CreateSyntaxPropertyAccessor<TypeDeclarationSyntax, ParameterListSyntax>(typeof(TypeDeclarationSyntax), nameof(ParameterList)); | ||
WithParameterListAccessor = LightupHelpers.CreateSyntaxWithPropertyAccessor<TypeDeclarationSyntax, ParameterListSyntax?>(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); | ||
} | ||
} |