Skip to content

Commit

Permalink
Update ImmutableObjectMethodAnalyzer.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Jan 3, 2023
1 parent 10f4d82 commit c8ae325
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,7 @@ public static void AnalyzeInvocationForIgnoredReturnValue(OperationAnalysisConte
return;
}

INamedTypeSymbol? type = null;
if (invocation.Instance is not null)
{
type = invocation.Instance.Type as INamedTypeSymbol;
}
else if (invocation.TargetMethod.IsExtensionMethod && invocation.TargetMethod.Parameters is [{ Type: var parameterType }, ..])
{
type = parameterType as INamedTypeSymbol;
}
INamedTypeSymbol? type = invocation.GetReceiverType(context.Compilation, beforeConversion: false, context.CancellationToken);

// If we're not in one of the known immutable types, quit
if (type is not null && type.GetBaseTypesAndThis().Any(immutableTypeSymbols.Contains))
Expand Down

0 comments on commit c8ae325

Please sign in to comment.