Use InsnList's iterator instead of getFirst()/getNext()

master
Graham 5 years ago
parent 24ce226e5c
commit 271d2126c0
  1. 3
      asm/src/main/java/dev/openrs2/asm/InsnMatcher.java
  2. 3
      deob/src/main/java/dev/openrs2/deob/transform/CounterTransformer.java
  3. 3
      deob/src/main/java/dev/openrs2/deob/transform/FieldOrderTransformer.java

@ -216,7 +216,8 @@ public final class InsnMatcher {
private static List<AbstractInsnNode> createRealInsnList(InsnList list) {
List<AbstractInsnNode> realInsns = new ArrayList<>();
for (var insn = list.getFirst(); insn != null; insn = insn.getNext()) {
for (var it = list.iterator(); it.hasNext(); ) {
var insn = it.next();
if (insn.getOpcode() != -1) {
realInsns.add(insn);
}

@ -47,7 +47,8 @@ public final class CounterTransformer extends Transformer {
}
private void findCounters(MethodNode method, Map<MemberRef, Integer> references, Map<MemberRef, Integer> resets, Map<MemberRef, Integer> increments) {
for (var insn = method.instructions.getFirst(); insn != null; insn = insn.getNext()) {
for (var it = method.instructions.iterator(); it.hasNext(); ) {
var insn = it.next();
if (insn.getType() != AbstractInsnNode.FIELD_INSN) {
continue;
}

@ -20,7 +20,8 @@ public final class FieldOrderTransformer extends Transformer {
var fields = new HashMap<MemberDesc, Integer>();
var index = 0;
for (var insn = ctor.instructions.getFirst(); insn != null; insn = insn.getNext()) {
for (var it = ctor.instructions.iterator(); it.hasNext(); ) {
var insn = it.next();
if (insn.getOpcode() != opcode) {
continue;
}

Loading…
Cancel
Save