public static CilInstruction Create(CilOpCode code, IEnumerable <CilInstruction> operand) { if (code.OperandType != CilOperandType.InlineSwitch) { throw new ArgumentException("Opcode does not accept a collection of instructions as operand.", "code"); } return(new CilInstruction(0, code, new List <CilInstruction>(operand))); }
/// <summary> /// Writes the operation code to the output stream. /// </summary> /// <param name="opCode">The opcode to write.</param> private void WriteOpCode(CilOpCode opCode) { if (opCode.Size == 2) { _writer.WriteByte(opCode.Op1); } _writer.WriteByte(opCode.Op2); }
public static CilInstruction Create(CilOpCode code, float operand) { if (code.OperandType != CilOperandType.ShortInlineR) { throw new ArgumentException("Opcode does not accept a float32 operand.", "code"); } return(new CilInstruction(0, code, operand)); }
public static CilInstruction Create(CilOpCode code, string operand) { if (code.OperandType != CilOperandType.InlineString) { throw new ArgumentException("Opcode does not accept a string operand.", "code"); } return(new CilInstruction(0, code, operand)); }
public static CilInstruction Create(CilOpCode code, CilInstruction instruction) { if (code.OperandType != CilOperandType.ShortInlineBrTarget && code.OperandType != CilOperandType.InlineBrTarget) { throw new ArgumentException("Opcode does not accept an instruction operand.", "code"); } return(new CilInstruction(0, code, instruction)); }
public static CilInstruction Create(CilOpCode code) { if (code.OperandType != CilOperandType.InlineNone) { throw new ArgumentException("Opcode requires an operand.", "code"); } return(new CilInstruction(0, code, null)); }
public static CilInstruction Create(CilOpCode code, ParameterSignature operand) { if (code.OperandType != CilOperandType.InlineArgument && code.OperandType != CilOperandType.ShortInlineArgument) { throw new ArgumentException("Opcode does not accept a parameter operand.", "code"); } return(new CilInstruction(0, code, operand)); }
public static CilInstruction Create(CilOpCode code, VariableSignature operand) { if (code.OperandType != CilOperandType.InlineVar && code.OperandType != CilOperandType.ShortInlineVar) { throw new ArgumentException("Opcode does not accept a local variable operand.", "code"); } return(new CilInstruction(0, code, operand)); }
public static CilInstruction Create(CilOpCode code, IMemberReference operand) { switch (code.OperandType) { case CilOperandType.InlineField: case CilOperandType.InlineMethod: case CilOperandType.InlineTok: case CilOperandType.InlineType: return(new CilInstruction(0, code, operand)); } throw new ArgumentException("Opcode does not accept a member operand operand.", "code"); }
public CilInstruction(int offset, CilOpCode opCode, object operand) { Offset = offset; OpCode = opCode; Operand = operand; }
public virtual string FormatOpCode(CilOpCode opcode) { return(opcode.Name.ToLowerInvariant()); }