private void PushTargetObjectFor(MethodInfo methodToBeInvoked, Expression target, IType targetType)
{
if (targetType is IGenericParameter)
{
// If target is a generic parameter, its address must be loaded
// to allow a constrained method call
LoadAddress(target);
return;
}
if (targetType.IsValueType)
{
if (methodToBeInvoked.DeclaringType.IsValueType)
LoadAddress(target);
else
{
Visit(target);
EmitBox(PopType());
}
return;
}
// pushes target reference
Visit(target);
PopType();
}