Skip to content

Commit 510d949

Browse files
committed
Generate documentation comment for GetWrappedType
1 parent 365a26a commit 510d949

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.CodeGeneration/OperationLightupGenerator.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,11 @@ private void GenerateOperationWrapperHelper(in GeneratorExecutionContext context
684684
body: SyntaxFactory.Block(staticCtorStatements),
685685
expressionBody: null);
686686

687+
// /// <summary>
688+
// /// Gets the type that is wrapped by the given wrapper.
689+
// /// </summary>
690+
// /// <param name="wrapperType">Type of the wrapper for which the wrapped type should be retrieved.</param>
691+
// /// <returns>The wrapped type, or null if there is no info.</returns>
687692
// internal static Type GetWrappedType(Type wrapperType)
688693
// {
689694
// if (WrappedTypes.TryGetValue(wrapperType, out Type wrappedType))
@@ -730,6 +735,25 @@ private void GenerateOperationWrapperHelper(in GeneratorExecutionContext context
730735
SyntaxFactory.ReturnStatement(SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression))),
731736
expressionBody: null);
732737

738+
getWrappedType = getWrappedType.WithLeadingTrivia(SyntaxFactory.TriviaList(
739+
SyntaxFactory.Trivia(SyntaxFactory.DocumentationComment(
740+
SyntaxFactory.XmlText(" "),
741+
SyntaxFactory.XmlSummaryElement(
742+
SyntaxFactory.XmlNewLine(Environment.NewLine),
743+
SyntaxFactory.XmlText(" Gets the type that is wrapped by the given wrapper."),
744+
SyntaxFactory.XmlNewLine(Environment.NewLine),
745+
SyntaxFactory.XmlText(" ")),
746+
SyntaxFactory.XmlNewLine(Environment.NewLine),
747+
SyntaxFactory.XmlText(" "),
748+
SyntaxFactory.XmlParamElement(
749+
"wrapperType",
750+
SyntaxFactory.XmlText("Type of the wrapper for which the wrapped type should be retrieved.")),
751+
SyntaxFactory.XmlNewLine(Environment.NewLine),
752+
SyntaxFactory.XmlText(" "),
753+
SyntaxFactory.XmlReturnsElement(
754+
SyntaxFactory.XmlText("The wrapped type, or null if there is no info.")),
755+
SyntaxFactory.XmlNewLine(Environment.NewLine).WithoutTrailingTrivia()))));
756+
733757
var wrapperHelperClass = SyntaxFactory.ClassDeclaration(
734758
attributeLists: default,
735759
modifiers: SyntaxTokenList.Create(SyntaxFactory.Token(SyntaxKind.InternalKeyword)).Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)),

StyleCop.Analyzers/StyleCop.Analyzers.CodeGeneration/SyntaxLightupGenerator.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,11 @@ private void GenerateSyntaxWrapperHelper(in GeneratorExecutionContext context, I
935935
body: SyntaxFactory.Block(staticCtorStatements),
936936
expressionBody: null);
937937

938+
// /// <summary>
939+
// /// Gets the type that is wrapped by the given wrapper.
940+
// /// </summary>
941+
// /// <param name="wrapperType">Type of the wrapper for which the wrapped type should be retrieved.</param>
942+
// /// <returns>The wrapped type, or null if there is no info.</returns>
938943
// internal static Type GetWrappedType(Type wrapperType)
939944
// {
940945
// if (WrappedTypes.TryGetValue(wrapperType, out Type wrappedType))
@@ -981,6 +986,25 @@ private void GenerateSyntaxWrapperHelper(in GeneratorExecutionContext context, I
981986
SyntaxFactory.ReturnStatement(SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression))),
982987
expressionBody: null);
983988

989+
getWrappedType = getWrappedType.WithLeadingTrivia(SyntaxFactory.TriviaList(
990+
SyntaxFactory.Trivia(SyntaxFactory.DocumentationComment(
991+
SyntaxFactory.XmlText(" "),
992+
SyntaxFactory.XmlSummaryElement(
993+
SyntaxFactory.XmlNewLine(Environment.NewLine),
994+
SyntaxFactory.XmlText(" Gets the type that is wrapped by the given wrapper."),
995+
SyntaxFactory.XmlNewLine(Environment.NewLine),
996+
SyntaxFactory.XmlText(" ")),
997+
SyntaxFactory.XmlNewLine(Environment.NewLine),
998+
SyntaxFactory.XmlText(" "),
999+
SyntaxFactory.XmlParamElement(
1000+
"wrapperType",
1001+
SyntaxFactory.XmlText("Type of the wrapper for which the wrapped type should be retrieved.")),
1002+
SyntaxFactory.XmlNewLine(Environment.NewLine),
1003+
SyntaxFactory.XmlText(" "),
1004+
SyntaxFactory.XmlReturnsElement(
1005+
SyntaxFactory.XmlText("The wrapped type, or null if there is no info.")),
1006+
SyntaxFactory.XmlNewLine(Environment.NewLine).WithoutTrailingTrivia()))));
1007+
9841008
var wrapperHelperClass = SyntaxFactory.ClassDeclaration(
9851009
attributeLists: default,
9861010
modifiers: SyntaxTokenList.Create(SyntaxFactory.Token(SyntaxKind.InternalKeyword)).Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)),

StyleCop.Analyzers/StyleCop.Analyzers/Lightup/.generated/StyleCop.Analyzers.CodeGeneration/StyleCop.Analyzers.CodeGeneration.OperationLightupGenerator/OperationWrapperHelper.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ static OperationWrapperHelper()
140140
WrappedTypes = builder.ToImmutable();
141141
}
142142

143+
/// <summary>
144+
/// Gets the type that is wrapped by the given wrapper.
145+
/// </summary>
146+
/// <param name = "wrapperType">Type of the wrapper for which the wrapped type should be retrieved.</param>
147+
/// <returns>The wrapped type, or null if there is no info.</returns>
143148
internal static Type GetWrappedType(Type wrapperType)
144149
{
145150
if (WrappedTypes.TryGetValue(wrapperType, out Type wrappedType))

StyleCop.Analyzers/StyleCop.Analyzers/Lightup/.generated/StyleCop.Analyzers.CodeGeneration/StyleCop.Analyzers.CodeGeneration.SyntaxLightupGenerator/SyntaxWrapperHelper.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ static SyntaxWrapperHelper()
7070
WrappedTypes = builder.ToImmutable();
7171
}
7272

73+
/// <summary>
74+
/// Gets the type that is wrapped by the given wrapper.
75+
/// </summary>
76+
/// <param name = "wrapperType">Type of the wrapper for which the wrapped type should be retrieved.</param>
77+
/// <returns>The wrapped type, or null if there is no info.</returns>
7378
internal static Type GetWrappedType(Type wrapperType)
7479
{
7580
if (WrappedTypes.TryGetValue(wrapperType, out Type wrappedType))

0 commit comments

Comments
 (0)