本文整理汇总了C#中System.Linq.Expressions.Interpreter.Instruction类的典型用法代码示例。如果您正苦于以下问题:C# Instruction类的具体用法?C# Instruction怎么用?C# Instruction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Instruction类属于System.Linq.Expressions.Interpreter命名空间,在下文中一共展示了Instruction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstructionArray
internal InstructionArray(int maxStackDepth, int maxContinuationDepth, Instruction[] instructions,
object[] objects, RuntimeLabel[] labels, List<KeyValuePair<int, object>> debugCookies)
{
MaxStackDepth = maxStackDepth;
MaxContinuationDepth = maxContinuationDepth;
Instructions = instructions;
DebugCookies = debugCookies;
Objects = objects;
Labels = labels;
}
示例2: Create
public static Instruction Create(Type type)
{
Debug.Assert(!type.GetTypeInfo().IsEnum);
switch (type.GetNonNullableType().GetTypeCode())
{
case TypeCode.Int16: return s_int16 ?? (s_int16 = new NegateCheckedInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new NegateCheckedInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new NegateCheckedInt64());
case TypeCode.Single: return s_single ?? (s_single = new NegateCheckedSingle());
case TypeCode.Double: return s_double ?? (s_double = new NegateCheckedDouble());
default:
throw Error.ExpressionNotSupportedForType("NegateChecked", type);
}
}
示例3: Create
public static Instruction Create(Type type)
{
// Boxed enums can be unboxed as their underlying types:
Type underlyingType = type.GetTypeInfo().IsEnum ? Enum.GetUnderlyingType(type) : TypeUtils.GetNonNullableType(type);
switch (underlyingType.GetTypeCode())
{
case TypeCode.SByte: return s_SByte ?? (s_SByte = new LeftShiftSByte());
case TypeCode.Byte: return s_byte ?? (s_byte = new LeftShiftByte());
case TypeCode.Int16: return s_int16 ?? (s_int16 = new LeftShiftInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new LeftShiftInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new LeftShiftInt64());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new LeftShiftUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new LeftShiftUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new LeftShiftUInt64());
default:
throw Error.ExpressionNotSupportedForType("LeftShift", type);
}
}
示例4: Create
public static Instruction Create(Type type)
{
Debug.Assert(type.IsArithmetic());
switch (type.GetNonNullableType().GetTypeCode())
{
case TypeCode.Int16: return s_int16 ?? (s_int16 = new SubOvfInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new SubOvfInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new SubOvfInt64());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new SubOvfUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new SubOvfUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new SubOvfUInt64());
default:
return SubInstruction.Create(type);
}
}
示例5: Create
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());
}
}
示例6: Create
public static Instruction Create(Type type)
{
// Boxed enums can be unboxed as their underlying types:
switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(type.GetTypeInfo().IsEnum ? Enum.GetUnderlyingType(type) : TypeUtils.GetNonNullableType(type)))
{
case TypeCode.SByte: return s_SByte ?? (s_SByte = new OrSByte());
case TypeCode.Byte: return s_byte ?? (s_byte = new OrByte());
case TypeCode.Int16: return s_int16 ?? (s_int16 = new OrInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new OrInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new OrInt64());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new OrUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new OrUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new OrUInt64());
case TypeCode.Boolean: return s_bool ?? (s_bool = new OrBool());
default:
throw Error.ExpressionNotSupportedForType("Or", type);
}
}
示例7: Create
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);
}
}
}
示例8: Create
public static Instruction Create(Type type)
{
// Boxed enums can be unboxed as their underlying types:
Type underlyingType = type.GetTypeInfo().IsEnum ? Enum.GetUnderlyingType(type) : type.GetNonNullableType();
switch (underlyingType.GetTypeCode())
{
case TypeCode.SByte: return s_SByte ?? (s_SByte = new AndSByte());
case TypeCode.Int16: return s_Int16 ?? (s_Int16 = new AndInt16());
case TypeCode.Int32: return s_Int32 ?? (s_Int32 = new AndInt32());
case TypeCode.Int64: return s_Int64 ?? (s_Int64 = new AndInt64());
case TypeCode.Byte: return s_Byte ?? (s_Byte = new AndByte());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new AndUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new AndUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new AndUInt64());
case TypeCode.Boolean: return s_Boolean ?? (s_Boolean = new AndBoolean());
default:
throw Error.ExpressionNotSupportedForType("And", type);
}
}
示例9: Emit
public void Emit(Instruction instruction)
{
_instructions.Add(instruction);
UpdateStackDepth(instruction);
}
示例10: InstructionView
public InstructionView(Instruction instruction, string name, int index, int stackDepth, int continuationsDepth)
{
_instruction = instruction;
_name = name;
_index = index;
_stackDepth = stackDepth;
_continuationsDepth = continuationsDepth;
}
示例11: Create
public static Instruction Create(Type type)
{
Debug.Assert(!type.GetTypeInfo().IsEnum);
switch (TypeUtils.GetNonNullableType(type).GetTypeCode())
{
case TypeCode.Int16: return s_int16 ?? (s_int16 = new IncrementInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new IncrementInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new IncrementInt64());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new IncrementUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new IncrementUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new IncrementUInt64());
case TypeCode.Single: return s_single ?? (s_single = new IncrementSingle());
case TypeCode.Double: return s_double ?? (s_double = new IncrementDouble());
default:
throw Error.ExpressionNotSupportedForType("Increment", type);
}
}
示例12: Create
public static Instruction Create(Type type, bool liftedToNull)
{
// Boxed enums can be unboxed as their underlying types:
Type underlyingType = type.GetTypeInfo().IsEnum ? Enum.GetUnderlyingType(type) : type.GetNonNullableType();
if (liftedToNull)
{
switch (underlyingType.GetTypeCode())
{
case TypeCode.Boolean: return s_booleanLiftedToNull ?? (s_booleanLiftedToNull = new EqualBooleanLiftedToNull());
case TypeCode.SByte: return s_SByteLiftedToNull ?? (s_SByteLiftedToNull = new EqualSByteLiftedToNull());
case TypeCode.Byte: return s_byteLiftedToNull ?? (s_byteLiftedToNull = new EqualByteLiftedToNull());
case TypeCode.Char: return s_charLiftedToNull ?? (s_charLiftedToNull = new EqualCharLiftedToNull());
case TypeCode.Int16: return s_int16LiftedToNull ?? (s_int16LiftedToNull = new EqualInt16LiftedToNull());
case TypeCode.Int32: return s_int32LiftedToNull ?? (s_int32LiftedToNull = new EqualInt32LiftedToNull());
case TypeCode.Int64: return s_int64LiftedToNull ?? (s_int64LiftedToNull = new EqualInt64LiftedToNull());
case TypeCode.UInt16: return s_UInt16LiftedToNull ?? (s_UInt16LiftedToNull = new EqualUInt16LiftedToNull());
case TypeCode.UInt32: return s_UInt32LiftedToNull ?? (s_UInt32LiftedToNull = new EqualUInt32LiftedToNull());
case TypeCode.UInt64: return s_UInt64LiftedToNull ?? (s_UInt64LiftedToNull = new EqualUInt64LiftedToNull());
case TypeCode.Single: return s_singleLiftedToNull ?? (s_singleLiftedToNull = new EqualSingleLiftedToNull());
default:
Debug.Assert(underlyingType.GetTypeCode() == TypeCode.Double);
return s_doubleLiftedToNull ?? (s_doubleLiftedToNull = new EqualDoubleLiftedToNull());
}
}
else
{
switch (underlyingType.GetTypeCode())
{
case TypeCode.Boolean: return s_boolean ?? (s_boolean = new EqualBoolean());
case TypeCode.SByte: return s_SByte ?? (s_SByte = new EqualSByte());
case TypeCode.Byte: return s_byte ?? (s_byte = new EqualByte());
case TypeCode.Char: return s_char ?? (s_char = new EqualChar());
case TypeCode.Int16: return s_int16 ?? (s_int16 = new EqualInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new EqualInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new EqualInt64());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new EqualUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new EqualUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new EqualUInt64());
case TypeCode.Single: return s_single ?? (s_single = new EqualSingle());
case TypeCode.Double: return s_double ?? (s_double = new EqualDouble());
default:
// Nullable only valid if one operand is constant null, so this assert is slightly too broad.
Debug.Assert(type.IsNullableOrReferenceType());
return s_reference ?? (s_reference = new EqualReference());
}
}
}
示例13: Create
public static Instruction Create(Type type)
{
Debug.Assert(TypeUtils.IsArithmetic(type));
switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(type)))
{
case TypeCode.Int16: return s_int16 ?? (s_int16 = new AddOvfInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new AddOvfInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new AddOvfInt64());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new AddOvfUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new AddOvfUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new AddOvfUInt64());
default:
return AddInstruction.Create(type);
}
}
示例14: Create
public static Instruction Create(Type type)
{
switch (TypeUtils.GetNonNullableType(type).GetTypeCode())
{
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 Error.ExpressionNotSupportedForType("Not", type);
}
}
示例15: Create
public static Instruction Create(Type type)
{
Debug.Assert(!type.IsEnum);
switch (TypeHelper.GetTypeCode(TypeHelper.GetNonNullableType(type)))
{
case TypeCode.Int16: return s_int16 ?? (s_int16 = new MulOvfInt16());
case TypeCode.Int32: return s_int32 ?? (s_int32 = new MulOvfInt32());
case TypeCode.Int64: return s_int64 ?? (s_int64 = new MulOvfInt64());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new MulOvfUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new MulOvfUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new MulOvfUInt64());
case TypeCode.Single: return s_single ?? (s_single = new MulOvfSingle());
case TypeCode.Double: return s_double ?? (s_double = new MulOvfDouble());
default:
throw Error.ExpressionNotSupportedForType("MulOvf", type);
}
}