Remove unused local variables of all types

This is required to clean up after the CopyPropagationTransformer.

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 4 years ago
parent ca419eecb5
commit 1308819561
  1. 10
      deob/src/main/java/dev/openrs2/deob/transform/UnusedLocalTransformer.kt

@ -29,7 +29,7 @@ class UnusedLocalTransformer : Transformer() {
val deadStores = mutableListOf<AbstractInsnNode>()
for (insn in method.instructions) {
if (insn !is VarInsnNode || insn.opcode != Opcodes.ISTORE) {
if (insn !is VarInsnNode || !STORE_OPCODES.contains(insn.opcode)) {
continue
}
@ -56,5 +56,13 @@ class UnusedLocalTransformer : Transformer() {
private companion object {
private val logger = InlineLogger()
private val STORE_OPCODES = setOf(
Opcodes.ISTORE,
Opcodes.LSTORE,
Opcodes.FSTORE,
Opcodes.DSTORE,
Opcodes.ASTORE
)
}
}

Loading…
Cancel
Save