private object ReadRawOperand(ByteOpCode opcode) { switch (opcode.OperandType) { case ByteCodeOperandType.None: return(null); case ByteCodeOperandType.Byte: case ByteCodeOperandType.ConstantIndex: case ByteCodeOperandType.LocalIndex: case ByteCodeOperandType.PrimitiveType: return(_reader.ReadByte()); case ByteCodeOperandType.Short: case ByteCodeOperandType.WideConstantIndex: case ByteCodeOperandType.BranchOffset: case ByteCodeOperandType.LocalConst: case ByteCodeOperandType.FieldIndex: case ByteCodeOperandType.MethodIndex: case ByteCodeOperandType.ClassIndex: return(_reader.ReadInt16()); case ByteCodeOperandType.TableSwitch: _reader.Position = FileSegment.Align((uint)_reader.Position, 4); return(TableSwitch.FromReader(_reader)); case ByteCodeOperandType.LookupSwitch: _reader.Position = FileSegment.Align((uint)_reader.Position, 4); return(LookupSwitch.FromReader(_reader)); case ByteCodeOperandType.WideIndexCountZero: case ByteCodeOperandType.WideIndexByte: case ByteCodeOperandType.WideBranchOffset: case ByteCodeOperandType.DynamicIndex: return(_reader.ReadInt32()); default: throw new ArgumentOutOfRangeException(); } }
public ByteCodeInstruction(int offset, ByteOpCode opCode, object operand) { Offset = offset; OpCode = opCode; Operand = operand; }
public ByteCodeInstruction(ByteOpCode opCode, object operand) : this(0, opCode, operand) { }
public ByteCodeInstruction(ByteOpCode opCode) : this(0, opCode, null) { }