Exemple #1
0
 public static Instruction Create(Type t)
 {
     switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(t)))
     {
         case TypeCode.Boolean: return _Bool ?? (_Bool = new BoolNot());
         case TypeCode.Int64: return _Int64 ?? (_Int64 = new Int64Not());
         case TypeCode.Int32: return _Int32 ?? (_Int32 = new Int32Not());
         case TypeCode.Int16: return _Int16 ?? (_Int16 = new Int16Not());
         case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new UInt64Not());
         case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new UInt32Not());
         case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new UInt16Not());
         case TypeCode.Byte: return _Byte ?? (_Byte = new ByteNot());
         case TypeCode.SByte: return _SByte ?? (_SByte = new SByteNot());
         default:
             throw new InvalidOperationException("Not for " + t.ToString());
     }
 }
Exemple #2
0
        public static Instruction Create(Type type)
        {
            switch (type.GetNonNullableType().GetTypeCode())
            {
                case TypeCode.Boolean: return s_Boolean ?? (s_Boolean = new BoolNot());
                case TypeCode.Int64: return s_Int64 ?? (s_Int64 = new Int64Not());
                case TypeCode.Int32: return s_Int32 ?? (s_Int32 = new Int32Not());
                case TypeCode.Int16: return s_Int16 ?? (s_Int16 = new Int16Not());
                case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new UInt64Not());
                case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new UInt32Not());
                case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new UInt16Not());
                case TypeCode.Byte: return s_Byte ?? (s_Byte = new ByteNot());
                case TypeCode.SByte: return s_SByte ?? (s_SByte = new SByteNot());

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