Beispiel #1
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.GetTypeInfo().IsEnum);
            switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(type)))
            {
            case TypeCode.Int16: return(s_int16 ?? (s_int16 = new DecrementInt16()));

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

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

            case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new DecrementUInt16()));

            case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new DecrementUInt32()));

            case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new DecrementUInt64()));

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

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

            default:
                throw Error.ExpressionNotSupportedForType("Decrement", type);
            }
        }
Beispiel #2
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum);
            switch (Type.GetTypeCode(type.GetNonNullable()))
            {
            case TypeCode.Int16: return(_int16 ?? (_int16 = new DecrementInt16()));

            case TypeCode.Int32: return(_int32 ?? (_int32 = new DecrementInt32()));

            case TypeCode.Int64: return(_int64 ?? (_int64 = new DecrementInt64()));

            case TypeCode.UInt16: return(_uInt16 ?? (_uInt16 = new DecrementUInt16()));

            case TypeCode.UInt32: return(_uInt32 ?? (_uInt32 = new DecrementUInt32()));

            case TypeCode.UInt64: return(_uInt64 ?? (_uInt64 = new DecrementUInt64()));

            case TypeCode.Single: return(_single ?? (_single = new DecrementSingle()));

            case TypeCode.Double: return(_double ?? (_double = new DecrementDouble()));

            default:
                throw ContractUtils.Unreachable;
            }
        }
Beispiel #3
0
 public static Instruction Create(Type type)
 {
     Debug.Assert(!type.IsEnum);
     return(type.GetNonNullableType().GetTypeCode() switch
     {
         TypeCode.Int16 => s_Int16 ?? (s_Int16 = new DecrementInt16()),
         TypeCode.Int32 => s_Int32 ?? (s_Int32 = new DecrementInt32()),
         TypeCode.Int64 => s_Int64 ?? (s_Int64 = new DecrementInt64()),
         TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new DecrementUInt16()),
         TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new DecrementUInt32()),
         TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new DecrementUInt64()),
         TypeCode.Single => s_Single ?? (s_Single = new DecrementSingle()),
         TypeCode.Double => s_Double ?? (s_Double = new DecrementDouble()),
         _ => throw ContractUtils.Unreachable,
     });
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.GetTypeInfo().IsEnum);
            switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(type)))
            {
                case TypeCode.Int16: return s_int16 ?? (s_int16 = new DecrementInt16());
                case TypeCode.Int32: return s_int32 ?? (s_int32 = new DecrementInt32());
                case TypeCode.Int64: return s_int64 ?? (s_int64 = new DecrementInt64());
                case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new DecrementUInt16());
                case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new DecrementUInt32());
                case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new DecrementUInt64());
                case TypeCode.Single: return s_single ?? (s_single = new DecrementSingle());
                case TypeCode.Double: return s_double ?? (s_double = new DecrementDouble());

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