IConstructor GetCorrectConstructor(Node sourceNode, IType type, ExpressionCollection arguments)
{
var constructors = type.GetConstructors().ToArray();
if (constructors.Length > 0)
return (IConstructor)GetCorrectCallableReference(sourceNode, arguments, constructors);
if (!IsError(type))
{
if (type is IGenericParameter)
Error(CompilerErrorFactory.CannotCreateAnInstanceOfGenericParameterWithoutDefaultConstructorConstraint(sourceNode, type));
else
Error(CompilerErrorFactory.NoApropriateConstructorFound(sourceNode, type, GetSignature(arguments)));
}
return null;
}