public void InsertBefore(Instruction target, Instruction instr) { int index = m_instrs.IndexOf(target); if (index == -1) { throw new ReflectionException("Target instruction not in method body"); } m_instrs.Insert(index, instr); instr.Previous = target.Previous; target.Previous = instr; instr.Next = target; }
public void InsertBefore(Instruction target, Instruction instr) { int index = m_instrs.IndexOf(target); if (index == -1) { throw new ArgumentOutOfRangeException("Target instruction not in method body"); } m_instrs.Insert(index, instr); instr.Previous = target.Previous; if (target.Previous != null) { target.Previous.Next = instr; } target.Previous = instr; instr.Next = target; }
public void InsertBefore(Instruction target, Instruction instruction) { if (target == null) { throw new ArgumentNullException("target"); } if (instruction == null) { throw new ArgumentNullException("instruction"); } var index = instructions.IndexOf(target); if (index == -1) { throw new ArgumentOutOfRangeException("target"); } instructions.Insert(index, instruction); }