mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C#: Improve LINQ expression based on review comments.
This commit is contained in:
@@ -42,13 +42,12 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
private static IMethodSymbol? GetImplicitConversionMethod(ITypeSymbol type, object value) =>
|
||||
type
|
||||
.GetMembers()
|
||||
.Where(m =>
|
||||
m is IMethodSymbol method &&
|
||||
.OfType<IMethodSymbol>()
|
||||
.Where(method =>
|
||||
method.GetName() == "op_Implicit" &&
|
||||
method.Parameters.Length == 1 &&
|
||||
method.Parameters[0].Type.Name == value.GetType().Name
|
||||
)
|
||||
.Cast<IMethodSymbol>()
|
||||
.FirstOrDefault();
|
||||
|
||||
// Creates a new generated expression with an implicit cast added, if needed.
|
||||
|
||||
Reference in New Issue
Block a user