Skip to content

Commit 78b6af1

Browse files
author
Markus Hartmair
committed
replace GetAncestor by TryCast of Parent
1 parent bcfd23f commit 78b6af1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Workspaces/VisualBasic/Portable/CaseCorrection/VisualBasicCaseCorrectionService.Rewriter.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CaseCorrection
126126
End If
127127
Else
128128
' Named tuple expression
129-
Dim simpleArgument = token.GetAncestor(Of SimpleArgumentSyntax)()
130-
If simpleArgument IsNot Nothing AndAlso TypeOf simpleArgument.Parent Is TupleExpressionSyntax AndAlso simpleArgument.NameColonEquals?.Name.Identifier = token Then
129+
Dim nameColonEquals = TryCast(token.Parent?.Parent, NameColonEqualsSyntax)
130+
If nameColonEquals IsNot Nothing AndAlso TypeOf nameColonEquals.Parent?.Parent Is TupleExpressionSyntax Then
131131
Return newToken
132132
End If
133133
End If

0 commit comments

Comments
 (0)