public FluentEmitter Starg(MagicNumberArgument value, params string[] names)
{
if (names == null)
{
throw new ArgumentNullException(nameof(names));
}
var count = names.Length;
var paramgroups = names
.Select(GetParameter)
.GroupBy(p => p.ParameterType.GetILType())
.OrderBy(pgroup => pgroup.Sum(p => p.Index));
foreach (var paramgroup in paramgroups)
{
var isfirst = true;
foreach (var param in paramgroup.OrderBy(p => p.Index))
{
if (isfirst)
{
switch (param.ParameterType.GetILType())
{
case ILType.I4: value.EmitLdcI4(this); break;
case ILType.I8: value.EmitLdcI8(this); break;
case ILType.R8: value.EmitLdcR8(this); break;
case ILType.R4: value.EmitLdcR4(this); break;
default:
throw new NotSupportedException(
"variable type must be primitive valuetype in system namespace and convertible to I4, I8, R4 or R8");
}
isfirst = false;
}
else
{
Dup();
}
}
foreach (var param in paramgroup)
{
Starg((uint)param.Index);
}
}
return(this);
}