private ConstructorInfo ComputeCtor()
{
if (Compiler.CompileStubClassVar.isBound && _type == (Type)Compiler.CompileStubClassVar.deref())
return null;
int numArgs = _args.Count;
int numCtors;
ConstructorInfo ctor = Reflector.GetMatchingConstructor(_spanMap, _type, _args, out numCtors);
if (numCtors == 0)
{
if (_type.IsValueType && numArgs == 0)
{
// Value types have a default no-arg c-tor that is not picked up in the regular c-tors.
_isNoArgValueTypeCtor = true;
return null;
}
throw new InvalidOperationException(string.Format("No constructor in type: {0} with {1} arguments", _type.Name, numArgs));
}
if (ctor == null && RT.booleanCast(RT.WarnOnReflectionVar.deref()))
RT.errPrintWriter().WriteLine("Reflection warning, {0}:{1} - call to {2} ctor can't be resolved.",
Compiler.SourcePathVar.deref(), _spanMap != null ? (int)_spanMap.valAt(RT.StartLineKey, 0) : 0, _type.FullName);
return ctor;
}