copy InsnList start included, end excluded @param list @param start @param end @return
(InsnList list, AbstractInsnNode start, AbstractInsnNode end)
| 28 | * @return |
| 29 | */ |
| 30 | public static InsnList copy(InsnList list, AbstractInsnNode start, AbstractInsnNode end) { |
| 31 | InsnList newList = new InsnList(); |
| 32 | Map<LabelNode, LabelNode> labelMap = getLabelMap(list); |
| 33 | AbstractInsnNode ain = start == null ? list.getFirst() : start; |
| 34 | while (ain != null && ain != end) { |
| 35 | newList.add(ain.clone(labelMap)); |
| 36 | ain = ain.getNext(); |
| 37 | } |
| 38 | return newList; |
| 39 | } |
| 40 | |
| 41 | public static MethodNode cloneInstructions(MethodNode method, String newName) { |
| 42 | MethodNode mn = new MethodNode(method.access, newName != null ? newName : method.name, method.desc, |
no test coverage detected