TriAxis.RunSharp.CodeGen.EmitGetHelper_Conversion C# (CSharp) Method

EmitGetHelper_Conversion() private method

private EmitGetHelper_Conversion ( Operand op, Type desiredType, Conversion conv, Type from = null ) : void
op Operand
desiredType IKVM.Reflection.Type
conv Conversion
from IKVM.Reflection.Type
return void
        void EmitGetHelper_Conversion(Operand op, Type desiredType, Conversion conv, Type from = null)
        {
            if (conv.RequiresAddress)
            {
                if (ReferenceEquals(op, null))
                    throw new ArgumentException("Conversion from nullref to " + desiredType.Name + " is impossible; for nullables variable it's required to load address.");

                op.EmitAddressOf(this);
            }
            else if (ReferenceEquals(op, null))
                IL.Emit(OpCodes.Ldnull);
            else
                op.EmitGet(this);
            if (from == null)
                from = (object)op == null ? null : op.GetReturnType(TypeMapper);
            conv.Emit(this, from, desiredType);
        }