Add is prefix to boolean extension properties

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 47d1bc0bd2
commit 2471418d4a
  1. 2
      asm/src/main/java/dev/openrs2/asm/InsnListUtils.kt
  2. 4
      asm/src/main/java/dev/openrs2/asm/InsnNodeUtils.kt
  3. 6
      build.gradle.kts
  4. 10
      deob/src/main/java/dev/openrs2/deob/transform/ConstantArgTransformer.kt
  5. 4
      deob/src/main/java/dev/openrs2/deob/transform/UnusedLocalTransformer.kt

@ -26,7 +26,7 @@ fun getExpression(
}
insn = insn.previous
} while (insn != null && insn.sequential && filter(insn))
} while (insn != null && insn.isSequential && filter(insn))
return null
}

@ -265,7 +265,7 @@ val AbstractInsnNode.intConstant: Int?
}
}
val AbstractInsnNode.sequential: Boolean
val AbstractInsnNode.isSequential: Boolean
get() = when (this) {
is LabelNode -> false
is JumpInsnNode -> false
@ -274,7 +274,7 @@ val AbstractInsnNode.sequential: Boolean
else -> opcode !in THROW_RETURN_OPCODES
}
val AbstractInsnNode.pure: Boolean
val AbstractInsnNode.isPure: Boolean
get() = when (opcode) {
in PURE_OPCODES -> true
in IMPURE_OPCODES -> false

@ -87,10 +87,10 @@ allprojects {
}
}
val Project.free: Boolean
val Project.isFree: Boolean
get() = name != "nonfree" && parent?.name != "nonfree"
configure(subprojects.filter { it.free }) {
configure(subprojects.filter { it.isFree }) {
apply(plugin = "jacoco")
plugins.withType<KotlinPluginWrapper> {
@ -215,7 +215,7 @@ tasks.dokka {
outputDirectory = "${project.buildDir}/kdoc"
outputFormat = "html"
subProjects = subprojects.filter { it.free && it.name != "deob-annotations" }.map { it.name }
subProjects = subprojects.filter { it.isFree && it.name != "deob-annotations" }.map { it.name }
configuration {
includeNonPublic = true

@ -9,8 +9,8 @@ import dev.openrs2.asm.createIntConstant
import dev.openrs2.asm.deleteExpression
import dev.openrs2.asm.hasCode
import dev.openrs2.asm.intConstant
import dev.openrs2.asm.isPure
import dev.openrs2.asm.nextReal
import dev.openrs2.asm.pure
import dev.openrs2.asm.replaceExpression
import dev.openrs2.asm.stackMetadata
import dev.openrs2.asm.transform.Transformer
@ -230,13 +230,13 @@ class ConstantArgTransformer : Transformer() {
for (insn in alwaysTakenBranches) {
val replacement = JumpInsnNode(GOTO, insn.label)
if (method.instructions.replaceExpression(insn, replacement, AbstractInsnNode::pure)) {
if (method.instructions.replaceExpression(insn, replacement, AbstractInsnNode::isPure)) {
simplified++
}
}
for (insn in neverTakenBranches) {
if (method.instructions.deleteExpression(insn, AbstractInsnNode::pure)) {
if (method.instructions.deleteExpression(insn, AbstractInsnNode::isPure)) {
simplified++
}
}
@ -259,7 +259,7 @@ class ConstantArgTransformer : Transformer() {
if (insn.intConstant != null) {
// already constant
continue
} else if (!insn.pure) {
} else if (!insn.isPure) {
// can't replace instructions with a side effect
continue
} else if (insn.stackMetadata.pushes != 1) {
@ -287,7 +287,7 @@ class ConstantArgTransformer : Transformer() {
}
val replacement = createIntConstant(value)
if (method.instructions.replaceExpression(insn, replacement, AbstractInsnNode::pure)) {
if (method.instructions.replaceExpression(insn, replacement, AbstractInsnNode::isPure)) {
inlined++
}
}

@ -4,7 +4,7 @@ import com.github.michaelbull.logging.InlineLogger
import dev.openrs2.asm.classpath.ClassPath
import dev.openrs2.asm.classpath.Library
import dev.openrs2.asm.deleteExpression
import dev.openrs2.asm.pure
import dev.openrs2.asm.isPure
import dev.openrs2.asm.transform.Transformer
import dev.openrs2.deob.analysis.LiveVariableAnalyzer
import org.objectweb.asm.Opcodes
@ -42,7 +42,7 @@ class UnusedLocalTransformer : Transformer() {
}
for (insn in deadStores) {
if (method.instructions.deleteExpression(insn, AbstractInsnNode::pure)) {
if (method.instructions.deleteExpression(insn, AbstractInsnNode::isPure)) {
localsRemoved++
}
}

Loading…
Cancel
Save