Convert hasCode() to a property

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 9de55399f5
commit 7e422447ef
  1. 2
      asm/src/main/java/dev/openrs2/asm/ClassNodeRemapper.kt
  2. 5
      asm/src/main/java/dev/openrs2/asm/MethodNodeUtils.kt
  3. 2
      asm/src/main/java/dev/openrs2/asm/transform/Transformer.kt
  4. 2
      bundler/src/main/java/dev/openrs2/bundler/transform/BufferSizeTransformer.kt
  5. 2
      deob/src/main/java/dev/openrs2/deob/transform/BitwiseOpTransformer.kt
  6. 2
      deob/src/main/java/dev/openrs2/deob/transform/ConstantArgTransformer.kt
  7. 2
      deob/src/main/java/dev/openrs2/deob/transform/CounterTransformer.kt
  8. 2
      deob/src/main/java/dev/openrs2/deob/transform/OpaquePredicateTransformer.kt
  9. 2
      deob/src/main/java/dev/openrs2/deob/transform/ResetTransformer.kt
  10. 4
      deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt

@ -31,7 +31,7 @@ fun ClassNode.remap(remapper: Remapper) {
method.signature = remapper.mapSignature(method.signature, false) method.signature = remapper.mapSignature(method.signature, false)
method.exceptions = method.exceptions.map(remapper::mapType) method.exceptions = method.exceptions.map(remapper::mapType)
if (method.hasCode()) { if (method.hasCode) {
ClassForNameUtils.remap(remapper, method) ClassForNameUtils.remap(remapper, method)
for (insn in method.instructions) { for (insn in method.instructions) {

@ -123,9 +123,8 @@ fun MethodNode.removeDeadCode(owner: String) {
} while (changed) } while (changed)
} }
fun MethodNode.hasCode(): Boolean { val MethodNode.hasCode
return access and (Opcodes.ACC_NATIVE or Opcodes.ACC_ABSTRACT) == 0 get() = access and (Opcodes.ACC_NATIVE or Opcodes.ACC_ABSTRACT) == 0
}
fun MethodNode.copy(): MethodNode { fun MethodNode.copy(): MethodNode {
val copy = MethodNode( val copy = MethodNode(

@ -26,7 +26,7 @@ abstract class Transformer {
for (method in clazz.methods) { for (method in clazz.methods) {
changed = changed or preTransformMethod(classPath, library, clazz, method) changed = changed or preTransformMethod(classPath, library, clazz, method)
if (method.hasCode()) { if (method.hasCode) {
changed = changed or transformCode(classPath, library, clazz, method) changed = changed or transformCode(classPath, library, clazz, method)
} }

@ -26,7 +26,7 @@ class BufferSizeTransformer : Transformer() {
for (library in classPath.libraries) { for (library in classPath.libraries) {
for (clazz in library) { for (clazz in library) {
for (method in clazz.methods) { for (method in clazz.methods) {
if (!method.hasCode()) { if (!method.hasCode) {
continue continue
} }

@ -27,7 +27,7 @@ class BitwiseOpTransformer : Transformer() {
for (library in classPath.libraries) { for (library in classPath.libraries) {
for (clazz in library) { for (clazz in library) {
for (method in clazz.methods) { for (method in clazz.methods) {
if (!method.hasCode()) { if (!method.hasCode) {
continue continue
} }

@ -99,7 +99,7 @@ class ConstantArgTransformer : Transformer() {
// find ClassNode/MethodNode // find ClassNode/MethodNode
val owner = classPath.getClassNode(ref.owner) ?: return val owner = classPath.getClassNode(ref.owner) ?: return
val originalMethod = owner.methods.singleOrNull { it.name == ref.name && it.desc == ref.desc } ?: return val originalMethod = owner.methods.singleOrNull { it.name == ref.name && it.desc == ref.desc } ?: return
if (!originalMethod.hasCode()) { if (!originalMethod.hasCode) {
return return
} }

@ -26,7 +26,7 @@ class CounterTransformer : Transformer() {
for (library in classPath.libraries) { for (library in classPath.libraries) {
for (clazz in library) { for (clazz in library) {
for (method in clazz.methods) { for (method in clazz.methods) {
if (method.hasCode()) { if (method.hasCode) {
findCounters(method, references, resets, increments) findCounters(method, references, resets, increments)
} }
} }

@ -30,7 +30,7 @@ class OpaquePredicateTransformer : Transformer() {
for (library in classPath.libraries) { for (library in classPath.libraries) {
for (clazz in library) { for (clazz in library) {
for (method in clazz.methods) { for (method in clazz.methods) {
if (method.hasCode()) { if (method.hasCode) {
findFlowObstructors(library, method) findFlowObstructors(library, method)
} }
} }

@ -28,7 +28,7 @@ class ResetTransformer : Transformer() {
for (library in classPath.libraries) { for (library in classPath.libraries) {
for (clazz in library) { for (clazz in library) {
for (method in clazz.methods) { for (method in clazz.methods) {
if (!method.hasCode()) { if (!method.hasCode) {
continue continue
} }

@ -36,7 +36,7 @@ class UnusedArgTransformer : Transformer() {
for (library in classPath.libraries) { for (library in classPath.libraries) {
for (clazz in library) { for (clazz in library) {
for (method in clazz.methods) { for (method in clazz.methods) {
if (method.hasCode()) { if (method.hasCode) {
populateRetainedArgs(classPath, clazz, method) populateRetainedArgs(classPath, clazz, method)
} }
} }
@ -94,7 +94,7 @@ class UnusedArgTransformer : Transformer() {
method: MethodNode method: MethodNode
): Boolean { ): Boolean {
// delete unused int args from call sites // delete unused int args from call sites
if (!method.hasCode()) { if (!method.hasCode) {
return false return false
} }

Loading…
Cancel
Save