Optimise CharLiteralTransformer

calculateResolveType() is much more expensive than checking if an
expression is an integer literal, so swap the conditions around.

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 4 years ago
parent 880be759b7
commit 2aee8523c7
  1. 4
      deob-ast/src/main/java/dev/openrs2/deob/ast/transform/CharLiteralTransformer.kt

@ -41,9 +41,9 @@ class CharLiteralTransformer : Transformer() {
}
private fun convertToCharLiteral(a: Expression, b: Expression) {
if (a.calculateResolvedType() != ResolvedPrimitiveType.CHAR) {
if (b !is IntegerLiteralExpr) {
return
} else if (b !is IntegerLiteralExpr) {
} else if (a.calculateResolvedType() != ResolvedPrimitiveType.CHAR) {
return
}

Loading…
Cancel
Save