using ReCodeIt.Enums;
using ReCodeIt.Models;
using Mono.Cecil;
using Mono.Cecil.Rocks;
namespace ReCodeIt.ReMapper.Search;
internal static class Constructors
{
///
/// Search for types with a constructor of a given length
///
///
///
/// Match if constructor parameters matches
public static EMatchResult GetTypeByParameterCount(TypeDefinition type, SearchParams parms, ScoringModel score)
{
if (parms.ConstructorParameterCount is null) return EMatchResult.Disabled;
var match = type.GetConstructors()
.Where(c => c.Parameters.Count == parms.ConstructorParameterCount)
.Any();
return match
? EMatchResult.Match
: EMatchResult.NoMatch;
}
}