Add else branch to non-exhaustive when statements

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 3 years ago
parent 5cbaf55dd6
commit f38253f2fc
  1. 1
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/IdentityTransformer.kt
  2. 1
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/NegativeLiteralTransformer.kt
  3. 1
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/util/ExprUtils.kt
  4. 2
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/ConstantArgTransformer.kt
  5. 1
      game/src/main/kotlin/org/openrs2/game/net/js5/Js5ChannelHandler.kt

@ -52,6 +52,7 @@ public class IdentityTransformer : Transformer() {
expr.replace(expr.left)
}
}
else -> Unit
}
}

@ -22,6 +22,7 @@ public class NegativeLiteralTransformer : Transformer() {
when (expr.operator) {
UnaryExpr.Operator.PLUS -> expr.replace(operand)
UnaryExpr.Operator.MINUS -> expr.replace(operand.negate())
else -> Unit
}
}
}

@ -91,6 +91,7 @@ public fun Expression.not(): Expression {
return BinaryExpr(left.not(), right.not(), BinaryExpr.Operator.OR)
BinaryExpr.Operator.OR ->
return BinaryExpr(left.not(), right.not(), BinaryExpr.Operator.AND)
else -> Unit
}
}
is BooleanLiteralExpr -> return BooleanLiteralExpr(!value)

@ -210,6 +210,7 @@ public class ConstantArgTransformer @Inject constructor(private val profile: Pro
when (IntBranch.evaluateUnary(insn.opcode, value.set.values)) {
ALWAYS_TAKEN -> alwaysTakenBranches += insn
NEVER_TAKEN -> neverTakenBranches += insn
else -> Unit
}
}
IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE -> {
@ -223,6 +224,7 @@ public class ConstantArgTransformer @Inject constructor(private val profile: Pro
when (IntBranch.evaluateBinary(insn.opcode, value1.set.values, value2.set.values)) {
ALWAYS_TAKEN -> alwaysTakenBranches += insn
NEVER_TAKEN -> neverTakenBranches += insn
else -> Unit
}
}
}

@ -21,6 +21,7 @@ public class Js5ChannelHandler @Inject constructor(
is Js5Request.Group -> service.push(client, msg)
is Js5Request.Rekey -> handleRekey(ctx, msg)
is Js5Request.Disconnect -> ctx.close()
else -> Unit
}
}

Loading…
Cancel
Save