public static Instruction Create(Type type) { Debug.Assert(!type.IsEnum); switch (type.GetTypeCode()) { case TypeCode.SByte: return(s_SByte ?? (s_SByte = new GreaterThanSByte())); case TypeCode.Byte: return(s_byte ?? (s_byte = new GreaterThanByte())); case TypeCode.Char: return(s_char ?? (s_char = new GreaterThanChar())); case TypeCode.Int16: return(s_int16 ?? (s_int16 = new GreaterThanInt16())); case TypeCode.Int32: return(s_int32 ?? (s_int32 = new GreaterThanInt32())); case TypeCode.Int64: return(s_int64 ?? (s_int64 = new GreaterThanInt64())); case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new GreaterThanUInt16())); case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new GreaterThanUInt32())); case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new GreaterThanUInt64())); case TypeCode.Single: return(s_single ?? (s_single = new GreaterThanSingle())); case TypeCode.Double: return(s_double ?? (s_double = new GreaterThanDouble())); default: throw Assert.Unreachable; } }
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 GreaterThanSByte(null)), TypeCode.Int16 => s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new GreaterThanInt16(null)), TypeCode.Char => s_liftedToNullChar ?? (s_liftedToNullChar = new GreaterThanChar(null)), TypeCode.Int32 => s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new GreaterThanInt32(null)), TypeCode.Int64 => s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new GreaterThanInt64(null)), TypeCode.Byte => s_liftedToNullByte ?? (s_liftedToNullByte = new GreaterThanByte(null)), TypeCode.UInt16 => s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new GreaterThanUInt16(null)), TypeCode.UInt32 => s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new GreaterThanUInt32(null)), TypeCode.UInt64 => s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new GreaterThanUInt64(null)), TypeCode.Single => s_liftedToNullSingle ?? (s_liftedToNullSingle = new GreaterThanSingle(null)), TypeCode.Double => s_liftedToNullDouble ?? (s_liftedToNullDouble = new GreaterThanDouble(null)), _ => throw ContractUtils.Unreachable, });
public static Instruction Create(Type type) { Debug.Assert(!type.IsEnum()); switch (type.GetTypeCode()) { case TypeCode.SByte: return _SByte ?? (_SByte = new GreaterThanSByte()); case TypeCode.Byte: return _Byte ?? (_Byte = new GreaterThanByte()); case TypeCode.Char: return _Char ?? (_Char = new GreaterThanChar()); case TypeCode.Int16: return _Int16 ?? (_Int16 = new GreaterThanInt16()); case TypeCode.Int32: return _Int32 ?? (_Int32 = new GreaterThanInt32()); case TypeCode.Int64: return _Int64 ?? (_Int64 = new GreaterThanInt64()); case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new GreaterThanUInt16()); case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new GreaterThanUInt32()); case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new GreaterThanUInt64()); case TypeCode.Single: return _Single ?? (_Single = new GreaterThanSingle()); case TypeCode.Double: return _Double ?? (_Double = new GreaterThanDouble()); default: throw Assert.Unreachable; } }
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 GreaterThanSByte(null))); case TypeCode.Byte: return(_liftedToNullByte ?? (_liftedToNullByte = new GreaterThanByte(null))); case TypeCode.Char: return(_liftedToNullChar ?? (_liftedToNullChar = new GreaterThanChar(null))); case TypeCode.Int16: return(_liftedToNullInt16 ?? (_liftedToNullInt16 = new GreaterThanInt16(null))); case TypeCode.Int32: return(_liftedToNullInt32 ?? (_liftedToNullInt32 = new GreaterThanInt32(null))); case TypeCode.Int64: return(_liftedToNullInt64 ?? (_liftedToNullInt64 = new GreaterThanInt64(null))); case TypeCode.UInt16: return(_liftedToNullUInt16 ?? (_liftedToNullUInt16 = new GreaterThanUInt16(null))); case TypeCode.UInt32: return(_liftedToNullUInt32 ?? (_liftedToNullUInt32 = new GreaterThanUInt32(null))); case TypeCode.UInt64: return(_liftedToNullUInt64 ?? (_liftedToNullUInt64 = new GreaterThanUInt64(null))); case TypeCode.Single: return(_liftedToNullSingle ?? (_liftedToNullSingle = new GreaterThanSingle(null))); case TypeCode.Double: return(_liftedToNullDouble ?? (_liftedToNullDouble = new GreaterThanDouble(null))); default: throw Error.ExpressionNotSupportedForType("GreaterThan", type); } } else { switch (type.GetNonNullableType().GetTypeCode()) { case TypeCode.SByte: return(_sbyte ?? (_sbyte = new GreaterThanSByte(ScriptingRuntimeHelpers.False))); case TypeCode.Byte: return(_byte ?? (_byte = new GreaterThanByte(ScriptingRuntimeHelpers.False))); case TypeCode.Char: return(_char ?? (_char = new GreaterThanChar(ScriptingRuntimeHelpers.False))); case TypeCode.Int16: return(_int16 ?? (_int16 = new GreaterThanInt16(ScriptingRuntimeHelpers.False))); case TypeCode.Int32: return(_int32 ?? (_int32 = new GreaterThanInt32(ScriptingRuntimeHelpers.False))); case TypeCode.Int64: return(_int64 ?? (_int64 = new GreaterThanInt64(ScriptingRuntimeHelpers.False))); case TypeCode.UInt16: return(_uint16 ?? (_uint16 = new GreaterThanUInt16(ScriptingRuntimeHelpers.False))); case TypeCode.UInt32: return(_uint32 ?? (_uint32 = new GreaterThanUInt32(ScriptingRuntimeHelpers.False))); case TypeCode.UInt64: return(_uint64 ?? (_uint64 = new GreaterThanUInt64(ScriptingRuntimeHelpers.False))); case TypeCode.Single: return(_single ?? (_single = new GreaterThanSingle(ScriptingRuntimeHelpers.False))); case TypeCode.Double: return(_double ?? (_double = new GreaterThanDouble(ScriptingRuntimeHelpers.False))); default: throw Error.ExpressionNotSupportedForType("GreaterThan", type); } } }
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 GreaterThanSByte(null))); case TypeCode.Int16: return(s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new GreaterThanInt16(null))); case TypeCode.Char: return(s_liftedToNullChar ?? (s_liftedToNullChar = new GreaterThanChar(null))); case TypeCode.Int32: return(s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new GreaterThanInt32(null))); case TypeCode.Int64: return(s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new GreaterThanInt64(null))); case TypeCode.Byte: return(s_liftedToNullByte ?? (s_liftedToNullByte = new GreaterThanByte(null))); case TypeCode.UInt16: return(s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new GreaterThanUInt16(null))); case TypeCode.UInt32: return(s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new GreaterThanUInt32(null))); case TypeCode.UInt64: return(s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new GreaterThanUInt64(null))); case TypeCode.Single: return(s_liftedToNullSingle ?? (s_liftedToNullSingle = new GreaterThanSingle(null))); case TypeCode.Double: return(s_liftedToNullDouble ?? (s_liftedToNullDouble = new GreaterThanDouble(null))); default: throw ContractUtils.Unreachable; } } else { switch (type.GetNonNullableType().GetTypeCode()) { case TypeCode.SByte: return(s_SByte ?? (s_SByte = new GreaterThanSByte(Utils.BoxedFalse))); case TypeCode.Int16: return(s_Int16 ?? (s_Int16 = new GreaterThanInt16(Utils.BoxedFalse))); case TypeCode.Char: return(s_Char ?? (s_Char = new GreaterThanChar(Utils.BoxedFalse))); case TypeCode.Int32: return(s_Int32 ?? (s_Int32 = new GreaterThanInt32(Utils.BoxedFalse))); case TypeCode.Int64: return(s_Int64 ?? (s_Int64 = new GreaterThanInt64(Utils.BoxedFalse))); case TypeCode.Byte: return(s_Byte ?? (s_Byte = new GreaterThanByte(Utils.BoxedFalse))); case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new GreaterThanUInt16(Utils.BoxedFalse))); case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new GreaterThanUInt32(Utils.BoxedFalse))); case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new GreaterThanUInt64(Utils.BoxedFalse))); case TypeCode.Single: return(s_Single ?? (s_Single = new GreaterThanSingle(Utils.BoxedFalse))); case TypeCode.Double: return(s_Double ?? (s_Double = new GreaterThanDouble(Utils.BoxedFalse))); default: throw ContractUtils.Unreachable; } } }
public static Instruction Create(Type type, bool liftedToNull = false) { Debug.Assert(!type.GetTypeInfo().IsEnum); if (liftedToNull) { switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(type))) { case TypeCode.SByte: return s_liftedToNullSByte ?? (s_liftedToNullSByte = new GreaterThanSByte(null)); case TypeCode.Byte: return s_liftedToNullByte ?? (s_liftedToNullByte = new GreaterThanByte(null)); case TypeCode.Char: return s_liftedToNullChar ?? (s_liftedToNullChar = new GreaterThanChar(null)); case TypeCode.Int16: return s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new GreaterThanInt16(null)); case TypeCode.Int32: return s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new GreaterThanInt32(null)); case TypeCode.Int64: return s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new GreaterThanInt64(null)); case TypeCode.UInt16: return s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new GreaterThanUInt16(null)); case TypeCode.UInt32: return s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new GreaterThanUInt32(null)); case TypeCode.UInt64: return s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new GreaterThanUInt64(null)); case TypeCode.Single: return s_liftedToNullSingle ?? (s_liftedToNullSingle = new GreaterThanSingle(null)); case TypeCode.Double: return s_liftedToNullDouble ?? (s_liftedToNullDouble = new GreaterThanDouble(null)); default: throw Error.ExpressionNotSupportedForType("GreaterThan", type); } } else { switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(type))) { case TypeCode.SByte: return s_SByte ?? (s_SByte = new GreaterThanSByte(ScriptingRuntimeHelpers.False)); case TypeCode.Byte: return s_byte ?? (s_byte = new GreaterThanByte(ScriptingRuntimeHelpers.False)); case TypeCode.Char: return s_char ?? (s_char = new GreaterThanChar(ScriptingRuntimeHelpers.False)); case TypeCode.Int16: return s_int16 ?? (s_int16 = new GreaterThanInt16(ScriptingRuntimeHelpers.False)); case TypeCode.Int32: return s_int32 ?? (s_int32 = new GreaterThanInt32(ScriptingRuntimeHelpers.False)); case TypeCode.Int64: return s_int64 ?? (s_int64 = new GreaterThanInt64(ScriptingRuntimeHelpers.False)); case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new GreaterThanUInt16(ScriptingRuntimeHelpers.False)); case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new GreaterThanUInt32(ScriptingRuntimeHelpers.False)); case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new GreaterThanUInt64(ScriptingRuntimeHelpers.False)); case TypeCode.Single: return s_single ?? (s_single = new GreaterThanSingle(ScriptingRuntimeHelpers.False)); case TypeCode.Double: return s_double ?? (s_double = new GreaterThanDouble(ScriptingRuntimeHelpers.False)); default: throw Error.ExpressionNotSupportedForType("GreaterThan", 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 GreaterThanSByte(null))); case TypeCode.Byte: return(s_liftedToNullByte ?? (s_liftedToNullByte = new GreaterThanByte(null))); case TypeCode.Char: return(s_liftedToNullChar ?? (s_liftedToNullChar = new GreaterThanChar(null))); case TypeCode.Int16: return(s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new GreaterThanInt16(null))); case TypeCode.Int32: return(s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new GreaterThanInt32(null))); case TypeCode.Int64: return(s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new GreaterThanInt64(null))); case TypeCode.UInt16: return(s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new GreaterThanUInt16(null))); case TypeCode.UInt32: return(s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new GreaterThanUInt32(null))); case TypeCode.UInt64: return(s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new GreaterThanUInt64(null))); case TypeCode.Single: return(s_liftedToNullSingle ?? (s_liftedToNullSingle = new GreaterThanSingle(null))); case TypeCode.Double: return(s_liftedToNullDouble ?? (s_liftedToNullDouble = new GreaterThanDouble(null))); default: throw Error.ExpressionNotSupportedForType("GreaterThan", type); } } else { switch (type.GetNonNullableType().GetTypeCode()) { case TypeCode.SByte: return(s_SByte ?? (s_SByte = new GreaterThanSByte(Utils.BoxedFalse))); case TypeCode.Byte: return(s_byte ?? (s_byte = new GreaterThanByte(Utils.BoxedFalse))); case TypeCode.Char: return(s_char ?? (s_char = new GreaterThanChar(Utils.BoxedFalse))); case TypeCode.Int16: return(s_int16 ?? (s_int16 = new GreaterThanInt16(Utils.BoxedFalse))); case TypeCode.Int32: return(s_int32 ?? (s_int32 = new GreaterThanInt32(Utils.BoxedFalse))); case TypeCode.Int64: return(s_int64 ?? (s_int64 = new GreaterThanInt64(Utils.BoxedFalse))); case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new GreaterThanUInt16(Utils.BoxedFalse))); case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new GreaterThanUInt32(Utils.BoxedFalse))); case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new GreaterThanUInt64(Utils.BoxedFalse))); case TypeCode.Single: return(s_single ?? (s_single = new GreaterThanSingle(Utils.BoxedFalse))); case TypeCode.Double: return(s_double ?? (s_double = new GreaterThanDouble(Utils.BoxedFalse))); default: throw Error.ExpressionNotSupportedForType("GreaterThan", type); } } }
public static Instruction CreateLifted(Type type) { Debug.Assert(!type.IsEnum()); switch (type.GetTypeCode()) { case TypeCode.SByte: return(_SByteLifted ?? (_SByteLifted = new GreaterThanSByte() { LiftedToNull = true })); case TypeCode.Byte: return(_ByteLifted ?? (_ByteLifted = new GreaterThanByte() { LiftedToNull = true })); case TypeCode.Char: return(_CharLifted ?? (_CharLifted = new GreaterThanChar() { LiftedToNull = true })); case TypeCode.Int16: return(_Int16Lifted ?? (_Int16Lifted = new GreaterThanInt16() { LiftedToNull = true })); case TypeCode.Int32: return(_Int32Lifted ?? (_Int32Lifted = new GreaterThanInt32() { LiftedToNull = true })); case TypeCode.Int64: return(_Int64Lifted ?? (_Int64Lifted = new GreaterThanInt64() { LiftedToNull = true })); case TypeCode.UInt16: return(_UInt16Lifted ?? (_UInt16Lifted = new GreaterThanUInt16() { LiftedToNull = true })); case TypeCode.UInt32: return(_UInt32Lifted ?? (_UInt32Lifted = new GreaterThanUInt32() { LiftedToNull = true })); case TypeCode.UInt64: return(_UInt64Lifted ?? (_UInt64Lifted = new GreaterThanUInt64() { LiftedToNull = true })); case TypeCode.Single: return(_SingleLifted ?? (_SingleLifted = new GreaterThanSingle() { LiftedToNull = true })); case TypeCode.Double: return(_DoubleLifted ?? (_DoubleLifted = new GreaterThanDouble() { LiftedToNull = true })); default: throw Assert.Unreachable; } }
public static Instruction CreateLifted(Type type) { Debug.Assert(!type.IsEnum()); switch (type.GetTypeCode()) { case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new GreaterThanSByte() { LiftedToNull = true }); case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new GreaterThanByte() { LiftedToNull = true }); case TypeCode.Char: return _CharLifted ?? (_CharLifted = new GreaterThanChar() { LiftedToNull = true }); case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new GreaterThanInt16() { LiftedToNull = true }); case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new GreaterThanInt32() { LiftedToNull = true }); case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new GreaterThanInt64() { LiftedToNull = true }); case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new GreaterThanUInt16() { LiftedToNull = true }); case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new GreaterThanUInt32() { LiftedToNull = true }); case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new GreaterThanUInt64() { LiftedToNull = true }); case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new GreaterThanSingle() { LiftedToNull = true }); case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new GreaterThanDouble() { LiftedToNull = true }); default: throw Assert.Unreachable; } }
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 GreaterThanSByte(null)); case TypeCode.Int16: return s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new GreaterThanInt16(null)); case TypeCode.Char: return s_liftedToNullChar ?? (s_liftedToNullChar = new GreaterThanChar(null)); case TypeCode.Int32: return s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new GreaterThanInt32(null)); case TypeCode.Int64: return s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new GreaterThanInt64(null)); case TypeCode.Byte: return s_liftedToNullByte ?? (s_liftedToNullByte = new GreaterThanByte(null)); case TypeCode.UInt16: return s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new GreaterThanUInt16(null)); case TypeCode.UInt32: return s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new GreaterThanUInt32(null)); case TypeCode.UInt64: return s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new GreaterThanUInt64(null)); case TypeCode.Single: return s_liftedToNullSingle ?? (s_liftedToNullSingle = new GreaterThanSingle(null)); case TypeCode.Double: return s_liftedToNullDouble ?? (s_liftedToNullDouble = new GreaterThanDouble(null)); default: throw Error.ExpressionNotSupportedForType("GreaterThan", type); } } else { switch (type.GetNonNullableType().GetTypeCode()) { case TypeCode.SByte: return s_SByte ?? (s_SByte = new GreaterThanSByte(Utils.BoxedFalse)); case TypeCode.Int16: return s_Int16 ?? (s_Int16 = new GreaterThanInt16(Utils.BoxedFalse)); case TypeCode.Char: return s_Char ?? (s_Char = new GreaterThanChar(Utils.BoxedFalse)); case TypeCode.Int32: return s_Int32 ?? (s_Int32 = new GreaterThanInt32(Utils.BoxedFalse)); case TypeCode.Int64: return s_Int64 ?? (s_Int64 = new GreaterThanInt64(Utils.BoxedFalse)); case TypeCode.Byte: return s_Byte ?? (s_Byte = new GreaterThanByte(Utils.BoxedFalse)); case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new GreaterThanUInt16(Utils.BoxedFalse)); case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new GreaterThanUInt32(Utils.BoxedFalse)); case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new GreaterThanUInt64(Utils.BoxedFalse)); case TypeCode.Single: return s_Single ?? (s_Single = new GreaterThanSingle(Utils.BoxedFalse)); case TypeCode.Double: return s_Double ?? (s_Double = new GreaterThanDouble(Utils.BoxedFalse)); default: throw Error.ExpressionNotSupportedForType("GreaterThan", type); } } }