AppendLabel() static private method

static private AppendLabel ( StringBuilder builder, Instruction instruction ) : void
builder StringBuilder
instruction Instruction
return void
Exemplo n.º 1
0
        public override string ToString()
        {
            StringBuilder stringBuilder;
            StringBuilder stringBuilder1 = new StringBuilder();

            Instruction.AppendLabel(stringBuilder1, this);
            stringBuilder1.Append(':');
            stringBuilder1.Append(' ');
            stringBuilder1.Append(this.opcode.Name);
            if (this.operand == null)
            {
                return(stringBuilder1.ToString());
            }
            stringBuilder1.Append(' ');
            OperandType operandType = this.opcode.OperandType;

            if (operandType > OperandType.InlineString)
            {
                if (operandType != OperandType.InlineSwitch)
                {
                    goto Label2;
                }
                Instruction[] instructionArray = (Instruction[])this.operand;
                for (int i = 0; i < (int)instructionArray.Length; i++)
                {
                    if (i > 0)
                    {
                        stringBuilder1.Append(',');
                    }
                    Instruction.AppendLabel(stringBuilder1, instructionArray[i]);
                }
                return(stringBuilder1.ToString());
            }
            else
            {
                if (operandType == OperandType.InlineBrTarget)
                {
                    Instruction.AppendLabel(stringBuilder1, (Instruction)this.operand);
                    return(stringBuilder1.ToString());
                }
                if (operandType != OperandType.InlineString)
                {
                    stringBuilder = stringBuilder1.Append(this.operand);
                    return(stringBuilder1.ToString());
                }
                stringBuilder1.Append('\"');
                stringBuilder1.Append(this.operand);
                stringBuilder1.Append('\"');
                return(stringBuilder1.ToString());
            }
            stringBuilder = stringBuilder1.Append(this.operand);
            return(stringBuilder1.ToString());

Label2:
            if (operandType != OperandType.ShortInlineBrTarget)
            {
                stringBuilder = stringBuilder1.Append(this.operand);
                return(stringBuilder1.ToString());
            }
            else
            {
                Instruction.AppendLabel(stringBuilder1, (Instruction)this.operand);
                return(stringBuilder1.ToString());
            }
        }