Skip to content

Commit

Permalink
Apply PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinAlpert committed Oct 30, 2023
1 parent 28a372c commit 88a1407
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override void Initialize(AnalysisContext context)
operationBlockContext.RegisterOperationAction(operationContext =>
{
var throwOperation = (IThrowOperation)operationContext.Operation;
if (ThrowOperationOccursInDelegate(throwOperation))
if (throwOperation.TryGetContainingAnonymousFunctionOrLocalFunction() is not null)
{
return;
}
Expand All @@ -115,22 +115,6 @@ public override void Initialize(AnalysisContext context)
});
}

private static bool ThrowOperationOccursInDelegate(IThrowOperation throwOperation)
{
var throwParent = throwOperation.Parent;
while (throwParent is not null)
{
if (throwParent is IDelegateCreationOperation)
{
return true;
}

throwParent = throwParent.Parent;
}

return false;
}

/// <summary>
/// This object describes a class of methods where exception throwing statements should be analyzed.
/// </summary>
Expand Down

0 comments on commit 88a1407

Please sign in to comment.