Ejemplo n.º 1
0
 public static Instruction Create(Type type)
 {
     Debug.Assert(!type.IsEnum);
     return(type.GetNonNullableType().GetTypeCode() switch
     {
         TypeCode.Int16 => s_Int16 ?? (s_Int16 = new NegateInt16()),
         TypeCode.Int32 => s_Int32 ?? (s_Int32 = new NegateInt32()),
         TypeCode.Int64 => s_Int64 ?? (s_Int64 = new NegateInt64()),
         TypeCode.Single => s_Single ?? (s_Single = new NegateSingle()),
         TypeCode.Double => s_Double ?? (s_Double = new NegateDouble()),
         _ => throw ContractUtils.Unreachable,
     });
Ejemplo n.º 2
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.GetTypeInfo().IsEnum);
            switch (type.GetNonNullableType().GetTypeCode())
            {
            case TypeCode.Int16: return(s_int16 ?? (s_int16 = new NegateInt16()));

            case TypeCode.Int32: return(s_int32 ?? (s_int32 = new NegateInt32()));

            case TypeCode.Int64: return(s_int64 ?? (s_int64 = new NegateInt64()));

            case TypeCode.Single: return(s_single ?? (s_single = new NegateSingle()));

            case TypeCode.Double: return(s_double ?? (s_double = new NegateDouble()));

            default:
                throw Error.ExpressionNotSupportedForType("Negate", type);
            }
        }
Ejemplo n.º 3
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum);
            switch (type.GetNonNullableType().GetTypeCode())
            {
            case TypeCode.Int16: return(s_Int16 ?? (s_Int16 = new NegateInt16()));

            case TypeCode.Int32: return(s_Int32 ?? (s_Int32 = new NegateInt32()));

            case TypeCode.Int64: return(s_Int64 ?? (s_Int64 = new NegateInt64()));

            case TypeCode.Single: return(s_Single ?? (s_Single = new NegateSingle()));

            case TypeCode.Double: return(s_Double ?? (s_Double = new NegateDouble()));

            default:
                throw ContractUtils.Unreachable;
            }
        }
Ejemplo n.º 4
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode())
            {
            case TypeCode.Int16: return(_Int16 ?? (_Int16 = new NegateInt16()));

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

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

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

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

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

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

            default:
                throw Assert.Unreachable;
            }
        }
Ejemplo n.º 5
0
        public static Instruction Create(Type type) {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode()) {
                case TypeCode.Int16: return _Int16 ?? (_Int16 = new NegateInt16());
                case TypeCode.Int32: return _Int32 ?? (_Int32 = new NegateInt32());
                case TypeCode.Int64: return _Int64 ?? (_Int64 = new NegateInt64());
                case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new NegateUInt16());
                case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new NegateUInt32());
                case TypeCode.Single: return _Single ?? (_Single = new NegateSingle());
                case TypeCode.Double: return _Double ?? (_Double = new NegateDouble());

                default:
                    throw Assert.Unreachable;
            }
        }
Ejemplo n.º 6
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.GetTypeInfo().IsEnum);
            switch (type.GetNonNullableType().GetTypeCode())
            {
                case TypeCode.Int16: return s_int16 ?? (s_int16 = new NegateInt16());
                case TypeCode.Int32: return s_int32 ?? (s_int32 = new NegateInt32());
                case TypeCode.Int64: return s_int64 ?? (s_int64 = new NegateInt64());
                case TypeCode.Single: return s_single ?? (s_single = new NegateSingle());
                case TypeCode.Double: return s_double ?? (s_double = new NegateDouble());

                default:
                    throw Error.ExpressionNotSupportedForType("Negate", type);
            }
        }