示例#1
0
文件: InsnList.cs 项目: NickAcPT/NAsm
        // insnNode now belongs to an InsnList.
        /// <summary>Inserts the given instructions before the specified instruction.</summary>
        /// <param name="nextInsn">
        ///     an instruction <i>of this list</i> before which the instructions must be
        ///     inserted.
        /// </param>
        /// <param name="insnList">
        ///     the instruction list to be inserted, which is cleared during the process. This
        ///     list must be different from 'this'.
        /// </param>
        public virtual void InsertBefore(AbstractInsnNode nextInsn, InsnList insnList)
        {
            if (insnList.size == 0)
            {
                return;
            }
            size__ += insnList.size;
            var firstInsnListElement = insnList.firstInsn;
            var lastInsnListElement  = insnList.lastInsn;
            var previousInsn         = nextInsn.previousInsn;

            if (previousInsn == null)
            {
                firstInsn = firstInsnListElement;
            }
            else
            {
                previousInsn.nextInsn = firstInsnListElement;
            }
            nextInsn.previousInsn             = lastInsnListElement;
            lastInsnListElement.nextInsn      = nextInsn;
            firstInsnListElement.previousInsn = previousInsn;
            cache = null;
            insnList.RemoveAll(false);
        }
示例#2
0
文件: InsnList.cs 项目: NickAcPT/NAsm
        // insnNode now belongs to an InsnList.
        /// <summary>Inserts the given instructions at the beginning of this list.</summary>
        /// <param name="insnList">
        ///     an instruction list, which is cleared during the process. This list must be
        ///     different from 'this'.
        /// </param>
        public virtual void Insert(InsnList insnList)
        {
            if (insnList.size == 0)
            {
                return;
            }
            size__ += insnList.size;
            if (firstInsn == null)
            {
                firstInsn = insnList.firstInsn;
                lastInsn  = insnList.lastInsn;
            }
            else
            {
                var lastInsnListElement = insnList.lastInsn;
                firstInsn.previousInsn       = lastInsnListElement;
                lastInsnListElement.nextInsn = firstInsn;
                firstInsn = insnList.firstInsn;
            }

            cache = null;
            insnList.RemoveAll(false);
        }
示例#3
0
文件: InsnList.cs 项目: NickAcPT/NAsm
        // insnNode now belongs to an InsnList.
        /// <summary>Adds the given instructions to the end of this list.</summary>
        /// <param name="insnList">
        ///     an instruction list, which is cleared during the process. This list must be
        ///     different from 'this'.
        /// </param>
        public virtual void Add(InsnList insnList)
        {
            if (insnList.Size() == 0)
            {
                return;
            }
            size__ += insnList.Size();
            if (lastInsn == null)
            {
                firstInsn = insnList.firstInsn;
                lastInsn  = insnList.lastInsn;
            }
            else
            {
                var firstInsnListElement = insnList.firstInsn;
                lastInsn.nextInsn = firstInsnListElement;
                firstInsnListElement.previousInsn = lastInsn;
                lastInsn = insnList.lastInsn;
            }

            cache = null;
            insnList.RemoveAll(false);
        }