Ejemplo n.º 1
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode())
            {
            case TypeCode.SByte: return(_SByte ?? (_SByte = new LessThanOrEqualSByte()));

            case TypeCode.Byte: return(_Byte ?? (_Byte = new LessThanOrEqualByte()));

            case TypeCode.Char: return(_Char ?? (_Char = new LessThanOrEqualChar()));

            case TypeCode.Int16: return(_Int16 ?? (_Int16 = new LessThanOrEqualInt16()));

            case TypeCode.Int32: return(_Int32 ?? (_Int32 = new LessThanOrEqualInt32()));

            case TypeCode.Int64: return(_Int64 ?? (_Int64 = new LessThanOrEqualInt64()));

            case TypeCode.UInt16: return(_UInt16 ?? (_UInt16 = new LessThanOrEqualUInt16()));

            case TypeCode.UInt32: return(_UInt32 ?? (_UInt32 = new LessThanOrEqualUInt32()));

            case TypeCode.UInt64: return(_UInt64 ?? (_UInt64 = new LessThanOrEqualUInt64()));

            case TypeCode.Single: return(_Single ?? (_Single = new LessThanOrEqualSingle()));

            case TypeCode.Double: return(_Double ?? (_Double = new LessThanOrEqualDouble()));

            default:
                throw Assert.Unreachable;
            }
        }
Ejemplo n.º 2
0
 public static Instruction Create(Type type, bool liftedToNull = false)
 {
     Debug.Assert(!type.IsEnum);
     if (liftedToNull)
     {
         return(type.GetNonNullableType().GetTypeCode() switch
         {
             TypeCode.SByte => s_liftedToNullSByte ?? (s_liftedToNullSByte = new LessThanOrEqualSByte(null)),
             TypeCode.Int16 => s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new LessThanOrEqualInt16(null)),
             TypeCode.Char => s_liftedToNullChar ?? (s_liftedToNullChar = new LessThanOrEqualChar(null)),
             TypeCode.Int32 => s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new LessThanOrEqualInt32(null)),
             TypeCode.Int64 => s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new LessThanOrEqualInt64(null)),
             TypeCode.Byte => s_liftedToNullByte ?? (s_liftedToNullByte = new LessThanOrEqualByte(null)),
             TypeCode.UInt16 => s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new LessThanOrEqualUInt16(null)),
             TypeCode.UInt32 => s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new LessThanOrEqualUInt32(null)),
             TypeCode.UInt64 => s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new LessThanOrEqualUInt64(null)),
             TypeCode.Single => s_liftedToNullSingle ?? (s_liftedToNullSingle = new LessThanOrEqualSingle(null)),
             TypeCode.Double => s_liftedToNullDouble ?? (s_liftedToNullDouble = new LessThanOrEqualDouble(null)),
             _ => throw ContractUtils.Unreachable,
         });
        public static Instruction Create(Type type, bool liftedToNull = false)
        {
            Debug.Assert(!type.IsEnum);
            if (liftedToNull)
            {
                switch (type.GetNonNullableType().GetTypeCode())
                {
                case TypeCode.SByte: return(s_liftedToNullSByte ?? (s_liftedToNullSByte = new LessThanOrEqualSByte(null)));

                case TypeCode.Int16: return(s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new LessThanOrEqualInt16(null)));

                case TypeCode.Char: return(s_liftedToNullChar ?? (s_liftedToNullChar = new LessThanOrEqualChar(null)));

                case TypeCode.Int32: return(s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new LessThanOrEqualInt32(null)));

                case TypeCode.Int64: return(s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new LessThanOrEqualInt64(null)));

                case TypeCode.Byte: return(s_liftedToNullByte ?? (s_liftedToNullByte = new LessThanOrEqualByte(null)));

                case TypeCode.UInt16: return(s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new LessThanOrEqualUInt16(null)));

                case TypeCode.UInt32: return(s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new LessThanOrEqualUInt32(null)));

                case TypeCode.UInt64: return(s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new LessThanOrEqualUInt64(null)));

                case TypeCode.Single: return(s_liftedToNullSingle ?? (s_liftedToNullSingle = new LessThanOrEqualSingle(null)));

                case TypeCode.Double: return(s_liftedToNullDouble ?? (s_liftedToNullDouble = new LessThanOrEqualDouble(null)));

                default:
                    throw Error.ExpressionNotSupportedForType("LessThanOrEqual", type);
                }
            }
            else
            {
                switch (type.GetNonNullableType().GetTypeCode())
                {
                case TypeCode.SByte: return(s_SByte ?? (s_SByte = new LessThanOrEqualSByte(Utils.BoxedFalse)));

                case TypeCode.Int16: return(s_Int16 ?? (s_Int16 = new LessThanOrEqualInt16(Utils.BoxedFalse)));

                case TypeCode.Char: return(s_Char ?? (s_Char = new LessThanOrEqualChar(Utils.BoxedFalse)));

                case TypeCode.Int32: return(s_Int32 ?? (s_Int32 = new LessThanOrEqualInt32(Utils.BoxedFalse)));

                case TypeCode.Int64: return(s_Int64 ?? (s_Int64 = new LessThanOrEqualInt64(Utils.BoxedFalse)));

                case TypeCode.Byte: return(s_Byte ?? (s_Byte = new LessThanOrEqualByte(Utils.BoxedFalse)));

                case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new LessThanOrEqualUInt16(Utils.BoxedFalse)));

                case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new LessThanOrEqualUInt32(Utils.BoxedFalse)));

                case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new LessThanOrEqualUInt64(Utils.BoxedFalse)));

                case TypeCode.Single: return(s_Single ?? (s_Single = new LessThanOrEqualSingle(Utils.BoxedFalse)));

                case TypeCode.Double: return(s_Double ?? (s_Double = new LessThanOrEqualDouble(Utils.BoxedFalse)));

                default:
                    throw Error.ExpressionNotSupportedForType("LessThanOrEqual", type);
                }
            }
        }
        public static Instruction Create(Type type, bool liftedToNull = false)
        {
            Debug.Assert(!type.GetTypeInfo().IsEnum);
            if (liftedToNull)
            {
                switch (type.GetNonNullableType().GetTypeCode())
                {
                    case TypeCode.SByte: return s_liftedToNullSByte ?? (s_liftedToNullSByte = new LessThanOrEqualSByte(null));
                    case TypeCode.Byte: return s_liftedToNullByte ?? (s_liftedToNullByte = new LessThanOrEqualByte(null));
                    case TypeCode.Char: return s_liftedToNullChar ?? (s_liftedToNullChar = new LessThanOrEqualChar(null));
                    case TypeCode.Int16: return s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new LessThanOrEqualInt16(null));
                    case TypeCode.Int32: return s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new LessThanOrEqualInt32(null));
                    case TypeCode.Int64: return s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new LessThanOrEqualInt64(null));
                    case TypeCode.UInt16: return s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new LessThanOrEqualUInt16(null));
                    case TypeCode.UInt32: return s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new LessThanOrEqualUInt32(null));
                    case TypeCode.UInt64: return s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new LessThanOrEqualUInt64(null));
                    case TypeCode.Single: return s_liftedToNullSingle ?? (s_liftedToNullSingle = new LessThanOrEqualSingle(null));
                    case TypeCode.Double: return s_liftedToNullDouble ?? (s_liftedToNullDouble = new LessThanOrEqualDouble(null));

                    default:
                        throw Error.ExpressionNotSupportedForType("LessThanOrEqual", type);
                }
            }
            else
            {
                switch (type.GetNonNullableType().GetTypeCode())
                {
                    case TypeCode.SByte: return s_SByte ?? (s_SByte = new LessThanOrEqualSByte(Utils.BoxedFalse));
                    case TypeCode.Byte: return s_byte ?? (s_byte = new LessThanOrEqualByte(Utils.BoxedFalse));
                    case TypeCode.Char: return s_char ?? (s_char = new LessThanOrEqualChar(Utils.BoxedFalse));
                    case TypeCode.Int16: return s_int16 ?? (s_int16 = new LessThanOrEqualInt16(Utils.BoxedFalse));
                    case TypeCode.Int32: return s_int32 ?? (s_int32 = new LessThanOrEqualInt32(Utils.BoxedFalse));
                    case TypeCode.Int64: return s_int64 ?? (s_int64 = new LessThanOrEqualInt64(Utils.BoxedFalse));
                    case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new LessThanOrEqualUInt16(Utils.BoxedFalse));
                    case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new LessThanOrEqualUInt32(Utils.BoxedFalse));
                    case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new LessThanOrEqualUInt64(Utils.BoxedFalse));
                    case TypeCode.Single: return s_single ?? (s_single = new LessThanOrEqualSingle(Utils.BoxedFalse));
                    case TypeCode.Double: return s_double ?? (s_double = new LessThanOrEqualDouble(Utils.BoxedFalse));

                    default:
                        throw Error.ExpressionNotSupportedForType("LessThanOrEqual", type);
                }
            }
        }
Ejemplo n.º 5
0
        public static Instruction Create(Type type, bool liftedToNull = false)
        {
            Debug.Assert(!type.IsEnum);
            if (liftedToNull)
            {
                switch (type.GetNonNullable().GetTypeCode())
                {
                case TypeCode.SByte: return(_liftedToNullSByte ?? (_liftedToNullSByte = new LessThanOrEqualSByte(null)));

                case TypeCode.Int16: return(_liftedToNullInt16 ?? (_liftedToNullInt16 = new LessThanOrEqualInt16(null)));

                case TypeCode.Char: return(_liftedToNullChar ?? (_liftedToNullChar = new LessThanOrEqualChar(null)));

                case TypeCode.Int32: return(_liftedToNullInt32 ?? (_liftedToNullInt32 = new LessThanOrEqualInt32(null)));

                case TypeCode.Int64: return(_liftedToNullInt64 ?? (_liftedToNullInt64 = new LessThanOrEqualInt64(null)));

                case TypeCode.Byte: return(_liftedToNullByte ?? (_liftedToNullByte = new LessThanOrEqualByte(null)));

                case TypeCode.UInt16: return(_liftedToNullUInt16 ?? (_liftedToNullUInt16 = new LessThanOrEqualUInt16(null)));

                case TypeCode.UInt32: return(_liftedToNullUInt32 ?? (_liftedToNullUInt32 = new LessThanOrEqualUInt32(null)));

                case TypeCode.UInt64: return(_liftedToNullUInt64 ?? (_liftedToNullUInt64 = new LessThanOrEqualUInt64(null)));

                case TypeCode.Single: return(_liftedToNullSingle ?? (_liftedToNullSingle = new LessThanOrEqualSingle(null)));

                case TypeCode.Double: return(_liftedToNullDouble ?? (_liftedToNullDouble = new LessThanOrEqualDouble(null)));

                default:
                    throw ContractUtils.Unreachable;
                }
            }

            switch (type.GetNonNullable().GetTypeCode())
            {
            case TypeCode.SByte: return(_sByte ?? (_sByte = new LessThanOrEqualSByte(Utils.BoxedFalse)));

            case TypeCode.Int16: return(_int16 ?? (_int16 = new LessThanOrEqualInt16(Utils.BoxedFalse)));

            case TypeCode.Char: return(_char ?? (_char = new LessThanOrEqualChar(Utils.BoxedFalse)));

            case TypeCode.Int32: return(_int32 ?? (_int32 = new LessThanOrEqualInt32(Utils.BoxedFalse)));

            case TypeCode.Int64: return(_int64 ?? (_int64 = new LessThanOrEqualInt64(Utils.BoxedFalse)));

            case TypeCode.Byte: return(_byte ?? (_byte = new LessThanOrEqualByte(Utils.BoxedFalse)));

            case TypeCode.UInt16: return(_uInt16 ?? (_uInt16 = new LessThanOrEqualUInt16(Utils.BoxedFalse)));

            case TypeCode.UInt32: return(_uInt32 ?? (_uInt32 = new LessThanOrEqualUInt32(Utils.BoxedFalse)));

            case TypeCode.UInt64: return(_uInt64 ?? (_uInt64 = new LessThanOrEqualUInt64(Utils.BoxedFalse)));

            case TypeCode.Single: return(_single ?? (_single = new LessThanOrEqualSingle(Utils.BoxedFalse)));

            case TypeCode.Double: return(_double ?? (_double = new LessThanOrEqualDouble(Utils.BoxedFalse)));

            default:
                throw ContractUtils.Unreachable;
            }
        }
Ejemplo n.º 6
0
        public static Instruction Create(Type type, bool liftedToNull)
        {
            Debug.Assert(!type.IsEnum);
            if (liftedToNull)
            {
                switch (type.GetNonNullableType().GetTypeCode())
                {
                case TypeCode.SByte:
                    return(_liftedToNullSByte ?? (_liftedToNullSByte = new LessThanOrEqualSByte(null)));

                case TypeCode.Byte:
                    return(_liftedToNullByte ?? (_liftedToNullByte = new LessThanOrEqualByte(null)));

                case TypeCode.Char:
                    return(_liftedToNullChar ?? (_liftedToNullChar = new LessThanOrEqualChar(null)));

                case TypeCode.Int16:
                    return(_liftedToNullInt16 ?? (_liftedToNullInt16 = new LessThanOrEqualInt16(null)));

                case TypeCode.Int32:
                    return(_liftedToNullInt32 ?? (_liftedToNullInt32 = new LessThanOrEqualInt32(null)));

                case TypeCode.Int64:
                    return(_liftedToNullInt64 ?? (_liftedToNullInt64 = new LessThanOrEqualInt64(null)));

                case TypeCode.UInt16:
                    return(_liftedToNullUInt16 ?? (_liftedToNullUInt16 = new LessThanOrEqualUInt16(null)));

                case TypeCode.UInt32:
                    return(_liftedToNullUInt32 ?? (_liftedToNullUInt32 = new LessThanOrEqualUInt32(null)));

                case TypeCode.UInt64:
                    return(_liftedToNullUInt64 ?? (_liftedToNullUInt64 = new LessThanOrEqualUInt64(null)));

                case TypeCode.Single:
                    return(_liftedToNullSingle ?? (_liftedToNullSingle = new LessThanOrEqualSingle(null)));

                case TypeCode.Double:
                    return(_liftedToNullDouble ?? (_liftedToNullDouble = new LessThanOrEqualDouble(null)));

                default:
                    throw Error.ExpressionNotSupportedForType("LessThanOrEqual", type);
                }
            }
            else
            {
                switch (type.GetNonNullableType().GetTypeCode())
                {
                case TypeCode.SByte:
                    return(_sbyte ?? (_sbyte = new LessThanOrEqualSByte(ScriptingRuntimeHelpers.False)));

                case TypeCode.Byte:
                    return(_byte ?? (_byte = new LessThanOrEqualByte(ScriptingRuntimeHelpers.False)));

                case TypeCode.Char:
                    return(_char ?? (_char = new LessThanOrEqualChar(ScriptingRuntimeHelpers.False)));

                case TypeCode.Int16:
                    return(_int16 ?? (_int16 = new LessThanOrEqualInt16(ScriptingRuntimeHelpers.False)));

                case TypeCode.Int32:
                    return(_int32 ?? (_int32 = new LessThanOrEqualInt32(ScriptingRuntimeHelpers.False)));

                case TypeCode.Int64:
                    return(_int64 ?? (_int64 = new LessThanOrEqualInt64(ScriptingRuntimeHelpers.False)));

                case TypeCode.UInt16:
                    return(_uint16 ?? (_uint16 = new LessThanOrEqualUInt16(ScriptingRuntimeHelpers.False)));

                case TypeCode.UInt32:
                    return(_uint32 ?? (_uint32 = new LessThanOrEqualUInt32(ScriptingRuntimeHelpers.False)));

                case TypeCode.UInt64:
                    return(_uint64 ?? (_uint64 = new LessThanOrEqualUInt64(ScriptingRuntimeHelpers.False)));

                case TypeCode.Single:
                    return(_single ?? (_single = new LessThanOrEqualSingle(ScriptingRuntimeHelpers.False)));

                case TypeCode.Double:
                    return(_double ?? (_double = new LessThanOrEqualDouble(ScriptingRuntimeHelpers.False)));

                default:
                    throw Error.ExpressionNotSupportedForType("LessThanOrEqual", type);
                }
            }
        }
Ejemplo n.º 7
0
        public static Instruction CreateLifted(Type type)
        {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode())
            {
            case TypeCode.SByte: return(_SByteLifted ?? (_SByteLifted = new LessThanOrEqualSByte()
                {
                    LiftedToNull = true
                }));

            case TypeCode.Byte: return(_ByteLifted ?? (_ByteLifted = new LessThanOrEqualByte()
                {
                    LiftedToNull = true
                }));

            case TypeCode.Char: return(_CharLifted ?? (_CharLifted = new LessThanOrEqualChar()
                {
                    LiftedToNull = true
                }));

            case TypeCode.Int16: return(_Int16Lifted ?? (_Int16Lifted = new LessThanOrEqualInt16()
                {
                    LiftedToNull = true
                }));

            case TypeCode.Int32: return(_Int32Lifted ?? (_Int32Lifted = new LessThanOrEqualInt32()
                {
                    LiftedToNull = true
                }));

            case TypeCode.Int64: return(_Int64Lifted ?? (_Int64Lifted = new LessThanOrEqualInt64()
                {
                    LiftedToNull = true
                }));

            case TypeCode.UInt16: return(_UInt16Lifted ?? (_UInt16Lifted = new LessThanOrEqualUInt16()
                {
                    LiftedToNull = true
                }));

            case TypeCode.UInt32: return(_UInt32Lifted ?? (_UInt32Lifted = new LessThanOrEqualUInt32()
                {
                    LiftedToNull = true
                }));

            case TypeCode.UInt64: return(_UInt64Lifted ?? (_UInt64Lifted = new LessThanOrEqualUInt64()
                {
                    LiftedToNull = true
                }));

            case TypeCode.Single: return(_SingleLifted ?? (_SingleLifted = new LessThanOrEqualSingle()
                {
                    LiftedToNull = true
                }));

            case TypeCode.Double: return(_DoubleLifted ?? (_DoubleLifted = new LessThanOrEqualDouble()
                {
                    LiftedToNull = true
                }));

            default:
                throw Assert.Unreachable;
            }
        }
Ejemplo n.º 8
0
        public static Instruction CreateLifted(Type type) {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode()) {
                case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new LessThanOrEqualSByte() { LiftedToNull = true });
                case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new LessThanOrEqualByte() { LiftedToNull = true });
                case TypeCode.Char: return _CharLifted ?? (_CharLifted = new LessThanOrEqualChar() { LiftedToNull = true });
                case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new LessThanOrEqualInt16() { LiftedToNull = true });
                case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new LessThanOrEqualInt32() { LiftedToNull = true });
                case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new LessThanOrEqualInt64() { LiftedToNull = true });
                case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new LessThanOrEqualUInt16() { LiftedToNull = true });
                case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new LessThanOrEqualUInt32() { LiftedToNull = true });
                case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new LessThanOrEqualUInt64() { LiftedToNull = true });
                case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new LessThanOrEqualSingle() { LiftedToNull = true });
                case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new LessThanOrEqualDouble() { LiftedToNull = true });

                default:
                    throw Assert.Unreachable;
            }
        }
Ejemplo n.º 9
0
        public static Instruction Create(Type type) {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode()) {
                case TypeCode.SByte: return _SByte ?? (_SByte = new LessThanOrEqualSByte());
                case TypeCode.Byte: return _Byte ?? (_Byte = new LessThanOrEqualByte());
                case TypeCode.Char: return _Char ?? (_Char = new LessThanOrEqualChar());
                case TypeCode.Int16: return _Int16 ?? (_Int16 = new LessThanOrEqualInt16());
                case TypeCode.Int32: return _Int32 ?? (_Int32 = new LessThanOrEqualInt32());
                case TypeCode.Int64: return _Int64 ?? (_Int64 = new LessThanOrEqualInt64());
                case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new LessThanOrEqualUInt16());
                case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new LessThanOrEqualUInt32());
                case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new LessThanOrEqualUInt64());
                case TypeCode.Single: return _Single ?? (_Single = new LessThanOrEqualSingle());
                case TypeCode.Double: return _Double ?? (_Double = new LessThanOrEqualDouble());

                default:
                    throw Assert.Unreachable;
            }
        }