Skip to content

Commit 3a83bd6

Browse files
Rename method
1 parent 41dfea5 commit 3a83bd6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CheckedExceptions/CheckedExceptionsAnalyzer.Shared.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ private IEnumerable<INamedTypeSymbol> GetExceptionTypes(AttributeSyntax attribut
124124
return node.Ancestors().OfType<CatchClauseSyntax>().FirstOrDefault();
125125
}
126126

127-
private static SyntaxNode GetExpression(SyntaxNode expression)
127+
private static SyntaxNode GetSignificantNode(SyntaxNode expression)
128128
{
129129
if (expression is InvocationExpressionSyntax ie)
130130
{
131-
return GetExpression(ie.Expression);
131+
return GetSignificantNode(ie.Expression);
132132
}
133133

134134
if (expression is MemberAccessExpressionSyntax mae)

CheckedExceptions/CheckedExceptionsAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ private void AnalyzeExceptionThrowingNode(
11951195
if (ShouldIgnore(node, mode))
11961196
{
11971197
// Report as THROW002 (Info level)
1198-
var diagnostic = Diagnostic.Create(RuleIgnoredException, GetExpression(node).GetLocation(), exceptionType.Name);
1198+
var diagnostic = Diagnostic.Create(RuleIgnoredException, GetSignificantNode(node).GetLocation(), exceptionType.Name);
11991199
context.ReportDiagnostic(diagnostic);
12001200
return;
12011201
}
@@ -1204,7 +1204,7 @@ private void AnalyzeExceptionThrowingNode(
12041204
// Check for general exceptions
12051205
if (IsGeneralException(exceptionType))
12061206
{
1207-
context.ReportDiagnostic(Diagnostic.Create(RuleGeneralThrow, GetExpression(node).GetLocation()));
1207+
context.ReportDiagnostic(Diagnostic.Create(RuleGeneralThrow, GetSignificantNode(node).GetLocation()));
12081208
}
12091209

12101210
// Check if the exception is declared via [Throws]
@@ -1223,7 +1223,7 @@ private void AnalyzeExceptionThrowingNode(
12231223

12241224
var verb = isThrowingConstruct ? THROW001Verbs.Is : THROW001Verbs.MightBe;
12251225

1226-
var diagnostic = Diagnostic.Create(RuleUnhandledException, GetExpression(node).GetLocation(), properties, exceptionType.Name, verb);
1226+
var diagnostic = Diagnostic.Create(RuleUnhandledException, GetSignificantNode(node).GetLocation(), properties, exceptionType.Name, verb);
12271227
context.ReportDiagnostic(diagnostic);
12281228
}
12291229
}

0 commit comments

Comments
 (0)