public virtual void Emit(OpCode opcode, Label label)
 {
     label.GetLabelValue();
     this.EnsureCapacity(7);
     this.InternalEmit(opcode);
     if (OpCodes.TakesSingleByteArgument(opcode))
     {
         this.AddFixup(label, this.m_length, 1);
         this.m_length++;
     }
     else
     {
         this.AddFixup(label, this.m_length, 4);
         this.m_length += 4;
     }
 }
        public virtual void Emit(OpCode opcode, LocalBuilder local)
        {
            if (local == null)
            {
                throw new ArgumentNullException("local");
            }
            int localIndex = local.GetLocalIndex();

            if (local.GetMethodBuilder() != this.m_methodBuilder)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_UnmatchedMethodForLocal"), "local");
            }
            if (opcode.Equals(OpCodes.Ldloc))
            {
                switch (localIndex)
                {
                case 0:
                    opcode = OpCodes.Ldloc_0;
                    goto Label_0123;

                case 1:
                    opcode = OpCodes.Ldloc_1;
                    goto Label_0123;

                case 2:
                    opcode = OpCodes.Ldloc_2;
                    goto Label_0123;

                case 3:
                    opcode = OpCodes.Ldloc_3;
                    goto Label_0123;
                }
                if (localIndex <= 0xff)
                {
                    opcode = OpCodes.Ldloc_S;
                }
            }
            else if (opcode.Equals(OpCodes.Stloc))
            {
                switch (localIndex)
                {
                case 0:
                    opcode = OpCodes.Stloc_0;
                    goto Label_0123;

                case 1:
                    opcode = OpCodes.Stloc_1;
                    goto Label_0123;

                case 2:
                    opcode = OpCodes.Stloc_2;
                    goto Label_0123;

                case 3:
                    opcode = OpCodes.Stloc_3;
                    goto Label_0123;
                }
                if (localIndex <= 0xff)
                {
                    opcode = OpCodes.Stloc_S;
                }
            }
            else if (opcode.Equals(OpCodes.Ldloca) && (localIndex <= 0xff))
            {
                opcode = OpCodes.Ldloca_S;
            }
Label_0123:
            this.EnsureCapacity(7);
            this.InternalEmit(opcode);
            if (opcode.OperandType != OperandType.InlineNone)
            {
                if (!OpCodes.TakesSingleByteArgument(opcode))
                {
                    this.m_ILStream[this.m_length++] = (byte)localIndex;
                    this.m_ILStream[this.m_length++] = (byte)(localIndex >> 8);
                }
                else
                {
                    if (localIndex > 0xff)
                    {
                        throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadInstructionOrIndexOutOfBound"));
                    }
                    this.m_ILStream[this.m_length++] = (byte)localIndex;
                }
            }
        }