Skip to content

Commit a792cf3

Browse files
YVbakkereNeRGy164
authored andcommitted
Use a switch expression to determine the methodName instead
1 parent ef654c4 commit a792cf3

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/DendroDocs.Tool/Analyzers/InvocationsAnalyzer.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,12 @@ public override void VisitInvocationExpression(InvocationExpressionSyntax node)
7575
var containingType = symbolInfo.Symbol?.ContainingSymbol ?? symbolInfo.CandidateSymbols.FirstOrDefault()?.ContainingSymbol;
7676
var containingTypeAsString = containingType?.ToDisplayString() ?? string.Empty;
7777

78-
var methodName = string.Empty;
79-
80-
switch (node.Expression)
78+
var methodName = node.Expression switch
8179
{
82-
case MemberAccessExpressionSyntax m:
83-
methodName = m.Name.ToString();
84-
break;
85-
case IdentifierNameSyntax i:
86-
methodName = i.Identifier.ValueText;
87-
break;
88-
}
80+
MemberAccessExpressionSyntax m => m.Name.ToString(),
81+
IdentifierNameSyntax i => i.Identifier.ValueText,
82+
_ => string.Empty
83+
};
8984

9085
var invocation = new InvocationDescription(containingTypeAsString, methodName);
9186
statements.Add(invocation);

0 commit comments

Comments
 (0)