Skip to content

Commit

Permalink
Merge pull request #162 from nenoNaninu/support_reserved_keyword_para…
Browse files Browse the repository at this point in the history
…meter

Support reserved keyword parameter
  • Loading branch information
nenoNaninu committed Dec 5, 2023
2 parents 43ac188 + a42f91c commit fcc79ae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/TypedSignalR.Client/CodeAnalysis/ParameterMetadata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;

namespace TypedSignalR.Client.CodeAnalysis;

Expand All @@ -13,7 +14,11 @@ public readonly record struct ParameterMetadata
public ParameterMetadata(IParameterSymbol parameterSymbol)
{
ParameterSymbol = parameterSymbol;
Name = parameterSymbol.Name;

Name = SyntaxFacts.IsReservedKeyword(SyntaxFacts.GetKeywordKind(parameterSymbol.Name))
? $"@{parameterSymbol.Name}"
: parameterSymbol.Name;

TypeName = parameterSymbol.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
}
}

0 comments on commit fcc79ae

Please sign in to comment.