Skip to content

Commit

Permalink
Code review simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
manfred-brands committed Sep 28, 2023
1 parent 3fc4980 commit ab8167d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,8 @@ private static bool IsAssignedIn(
if (method?.Parent == classDeclaration)
{
// We only get here if the method is in our source code and our class.
if (!visitedMethods.Contains(method))
if (visitedMethods.Add(method))
{
visitedMethods.Add(method);
return IsAssignedIn(model, classDeclaration, visitedMethods, method, fieldOrPropertyName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,8 @@ public bool IsLocalNotYetVisitedMethodCall(
InvocationExpressionSyntax invocationExpression,
[NotNullWhen(true)] out IMethodSymbol? calledMethod)
{
if (this.IsLocalMethodCall(invocationExpression, out calledMethod) &&
!this.visitedMethods.Contains(calledMethod))
{
this.visitedMethods.Add(calledMethod);
return true;
}

return false;
return this.IsLocalMethodCall(invocationExpression, out calledMethod) &&
this.visitedMethods.Add(calledMethod);
}

public bool IsDisposalOf(
Expand Down

0 comments on commit ab8167d

Please sign in to comment.