コード例 #1
0
        public void PutOpcode(Microsoft.Cci.OperationCode opcode, int target)
        {
            PutOpcode(opcode);
            switch (opcode)
            {
            case Microsoft.Cci.OperationCode.Beq:
            case Microsoft.Cci.OperationCode.Bge:
            case Microsoft.Cci.OperationCode.Bge_Un:
            case Microsoft.Cci.OperationCode.Bgt:
            case Microsoft.Cci.OperationCode.Bgt_Un:
            case Microsoft.Cci.OperationCode.Ble:
            case Microsoft.Cci.OperationCode.Ble_Un:
            case Microsoft.Cci.OperationCode.Blt:
            case Microsoft.Cci.OperationCode.Blt_Un:
            case Microsoft.Cci.OperationCode.Bne_Un:
            case Microsoft.Cci.OperationCode.Br:
            case Microsoft.Cci.OperationCode.Brfalse:
            case Microsoft.Cci.OperationCode.Brtrue:
            case Microsoft.Cci.OperationCode.Leave:
            case Microsoft.Cci.OperationCode.Ldc_I4:
                // ^ assume operation.Value is int;
                writer.WriteInt(target);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #2
0
 public void PutOpcode(Microsoft.Cci.OperationCode opcode)
 {
     if (opcode < Microsoft.Cci.OperationCode.Arglist)
     {
         writer.WriteByte((byte)opcode);
     }
     else
     {
         writer.WriteByte((byte)((ushort)opcode >> 8));
         writer.WriteByte((byte)((ushort)opcode & 0xff));
     }
 }
コード例 #3
0
        public void PutOpcode(Microsoft.Cci.OperationCode opcode, string str)
        {
            PutOpcode(opcode);

            var opcodeInfo = Microsoft.Cci.PeWriter.OperationCodeInfo(opcode);

            switch (opcodeInfo.OperandType)
            {
            case OperandType.InlineString:
                writer.WriteUint(moduleBeingBuilt.GetFakeStringTokenForIL(str));
                break;

            default:
                throw new NotImplementedException();
            }
        }
コード例 #4
0
        public void PutOpcode(Microsoft.Cci.OperationCode opcode, Symbol symbol)
        {
            PutOpcode(opcode);

            var opcodeInfo = Microsoft.Cci.PeWriter.OperationCodeInfo(opcode);

            switch (opcodeInfo.OperandType)
            {
            case OperandType.InlineField:
            case OperandType.InlineMethod:
            case OperandType.InlineTok:
            case OperandType.InlineType:
                writer.WriteUint(moduleBeingBuilt.GetFakeSymbolTokenForIL(moduleBeingBuilt.Translate(symbol)));
                break;

            default:
                throw new NotImplementedException();
            }
        }