Skip to content

Commit c315a6c

Browse files
committed
Fix some leftovers
1 parent 0262e78 commit c315a6c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.CodeFixers/UseGeneratedDependencyPropertyOnManualPropertyCodeFixer.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
8989
/// </summary>
9090
/// <param name="document">The original document being fixed.</param>
9191
/// <param name="semanticModel">The <see cref="SemanticModel"/> instance for the current compilation.</param>
92-
/// <param name="observablePropertyAttributeList">The resulting attribute list, if successfully retrieved.</param>
93-
/// <returns>Whether <paramref name="observablePropertyAttributeList"/> could be retrieved successfully.</returns>
94-
private static bool TryGetGeneratedObservablePropertyAttributeList(
92+
/// <param name="generatedDependencyPropertyAttributeList">The resulting attribute list, if successfully retrieved.</param>
93+
/// <returns>Whether <paramref name="generatedDependencyPropertyAttributeList"/> could be retrieved successfully.</returns>
94+
private static bool TryGetGeneratedDependencyPropertyAttributeList(
9595
Document document,
9696
SemanticModel semanticModel,
97-
[NotNullWhen(true)] out AttributeListSyntax? observablePropertyAttributeList)
97+
[NotNullWhen(true)] out AttributeListSyntax? generatedDependencyPropertyAttributeList)
9898
{
9999
// Make sure we can resolve the '[GeneratedDependencyProperty]' attribute
100100
if (semanticModel.Compilation.GetTypeByMetadataName(WellKnownTypeNames.GeneratedDependencyPropertyAttribute) is not INamedTypeSymbol attributeSymbol)
101101
{
102-
observablePropertyAttributeList = null;
102+
generatedDependencyPropertyAttributeList = null;
103103

104104
return false;
105105
}
@@ -109,7 +109,7 @@ private static bool TryGetGeneratedObservablePropertyAttributeList(
109109
// Create the attribute syntax for the new '[GeneratedDependencyProperty]' attribute here too
110110
SyntaxNode attributeTypeSyntax = syntaxGenerator.TypeExpression(attributeSymbol).WithAdditionalAnnotations(Simplifier.AddImportsAnnotation);
111111

112-
observablePropertyAttributeList = (AttributeListSyntax)syntaxGenerator.Attribute(attributeTypeSyntax);
112+
generatedDependencyPropertyAttributeList = (AttributeListSyntax)syntaxGenerator.Attribute(attributeTypeSyntax);
113113

114114
return true;
115115
}
@@ -135,7 +135,7 @@ private static async Task<Document> ConvertToPartialProperty(
135135
await Task.CompletedTask;
136136

137137
// If we can't generate the new attribute list, bail (this should never happen)
138-
if (!TryGetGeneratedObservablePropertyAttributeList(document, semanticModel, out AttributeListSyntax? observablePropertyAttributeList))
138+
if (!TryGetGeneratedDependencyPropertyAttributeList(document, semanticModel, out AttributeListSyntax? generatedDependencyPropertyAttributeList))
139139
{
140140
return document;
141141
}
@@ -146,7 +146,7 @@ private static async Task<Document> ConvertToPartialProperty(
146146
ConvertToPartialProperty(
147147
propertyDeclaration,
148148
fieldDeclaration,
149-
observablePropertyAttributeList,
149+
generatedDependencyPropertyAttributeList,
150150
syntaxEditor,
151151
defaultValueExpression);
152152

@@ -159,14 +159,14 @@ private static async Task<Document> ConvertToPartialProperty(
159159
/// </summary>
160160
/// <param name="propertyDeclaration">The <see cref="PropertyDeclarationSyntax"/> for the property being updated.</param>
161161
/// <param name="fieldDeclaration">The <see cref="FieldDeclarationSyntax"/> for the declared property to remove.</param>
162-
/// <param name="observablePropertyAttributeList">The <see cref="AttributeListSyntax"/> with the attribute to add.</param>
162+
/// <param name="generatedDependencyPropertyAttributeList">The <see cref="AttributeListSyntax"/> with the attribute to add.</param>
163163
/// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> instance to use.</param>
164164
/// <param name="defaultValueExpression">The expression for the default value of the property, if present</param>
165165
/// <returns>An updated document with the applied code fix, and <paramref name="propertyDeclaration"/> being replaced with a partial property.</returns>
166166
private static void ConvertToPartialProperty(
167167
PropertyDeclarationSyntax propertyDeclaration,
168168
FieldDeclarationSyntax fieldDeclaration,
169-
AttributeListSyntax observablePropertyAttributeList,
169+
AttributeListSyntax generatedDependencyPropertyAttributeList,
170170
SyntaxEditor syntaxEditor,
171171
string? defaultValueExpression)
172172
{
@@ -175,9 +175,9 @@ private static void ConvertToPartialProperty(
175175
// It's important to reuse it, as it has the "add usings" annotation.
176176
if (defaultValueExpression is not null)
177177
{
178-
observablePropertyAttributeList =
178+
generatedDependencyPropertyAttributeList =
179179
AttributeList(SingletonSeparatedList(
180-
observablePropertyAttributeList.Attributes[0]
180+
generatedDependencyPropertyAttributeList.Attributes[0]
181181
.AddArgumentListArguments(
182182
AttributeArgument(ParseExpression(defaultValueExpression))
183183
.WithNameEquals(NameEquals(IdentifierName("DefaultValue"))))));
@@ -194,18 +194,18 @@ private static void ConvertToPartialProperty(
194194
newNode: firstAttributeListSyntax.WithoutTrivia());
195195

196196
// If the property has at least an attribute list, move the trivia from it to the new attribute
197-
observablePropertyAttributeList = observablePropertyAttributeList.WithTriviaFrom(firstAttributeListSyntax);
197+
generatedDependencyPropertyAttributeList = generatedDependencyPropertyAttributeList.WithTriviaFrom(firstAttributeListSyntax);
198198

199199
// Insert the new attribute
200-
attributeLists = attributeLists.Insert(0, observablePropertyAttributeList);
200+
attributeLists = attributeLists.Insert(0, generatedDependencyPropertyAttributeList);
201201
}
202202
else
203203
{
204204
// Otherwise (there are no attribute lists), transfer the trivia to the new (only) attribute list
205-
observablePropertyAttributeList = observablePropertyAttributeList.WithTriviaFrom(propertyDeclaration);
205+
generatedDependencyPropertyAttributeList = generatedDependencyPropertyAttributeList.WithTriviaFrom(propertyDeclaration);
206206

207207
// Save the new attribute list
208-
attributeLists = attributeLists.Add(observablePropertyAttributeList);
208+
attributeLists = attributeLists.Add(generatedDependencyPropertyAttributeList);
209209
}
210210

211211
// Get a new property that is partial and with semicolon token accessors
@@ -268,7 +268,7 @@ private sealed class FixAllProvider : DocumentBasedFixAllProvider
268268
}
269269

270270
// If we can't generate the new attribute list, bail (this should never happen)
271-
if (!TryGetGeneratedObservablePropertyAttributeList(document, semanticModel, out AttributeListSyntax? observablePropertyAttributeList))
271+
if (!TryGetGeneratedDependencyPropertyAttributeList(document, semanticModel, out AttributeListSyntax? generatedDependencyPropertyAttributeList))
272272
{
273273
return document;
274274
}
@@ -297,7 +297,7 @@ private sealed class FixAllProvider : DocumentBasedFixAllProvider
297297
ConvertToPartialProperty(
298298
propertyDeclaration,
299299
fieldDeclaration,
300-
observablePropertyAttributeList,
300+
generatedDependencyPropertyAttributeList,
301301
syntaxEditor,
302302
defaultValue);
303303
}

0 commit comments

Comments
 (0)