|
|
@ -1,7 +1,6 @@ |
|
|
|
package dev.openrs2.deob.ast.transform; |
|
|
|
package dev.openrs2.deob.ast.transform; |
|
|
|
|
|
|
|
|
|
|
|
import com.github.javaparser.ast.CompilationUnit; |
|
|
|
import com.github.javaparser.ast.CompilationUnit; |
|
|
|
import com.github.javaparser.ast.NodeList; |
|
|
|
|
|
|
|
import com.github.javaparser.ast.stmt.IfStmt; |
|
|
|
import com.github.javaparser.ast.stmt.IfStmt; |
|
|
|
import com.github.javaparser.ast.stmt.Statement; |
|
|
|
import com.github.javaparser.ast.stmt.Statement; |
|
|
|
import dev.openrs2.deob.ast.util.ExprUtils; |
|
|
|
import dev.openrs2.deob.ast.util.ExprUtils; |
|
|
@ -11,7 +10,7 @@ public final class IfElseTransformer extends Transformer { |
|
|
|
if (stmt.isIfStmt()) { |
|
|
|
if (stmt.isIfStmt()) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} else if (stmt.isBlockStmt()) { |
|
|
|
} else if (stmt.isBlockStmt()) { |
|
|
|
NodeList<Statement> stmts = stmt.asBlockStmt().getStatements(); |
|
|
|
var stmts = stmt.asBlockStmt().getStatements(); |
|
|
|
return stmts.size() == 1 && stmts.get(0).isIfStmt(); |
|
|
|
return stmts.size() == 1 && stmts.get(0).isIfStmt(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -22,7 +21,7 @@ public final class IfElseTransformer extends Transformer { |
|
|
|
if (stmt.isIfStmt()) { |
|
|
|
if (stmt.isIfStmt()) { |
|
|
|
return stmt.clone(); |
|
|
|
return stmt.clone(); |
|
|
|
} else if (stmt.isBlockStmt()) { |
|
|
|
} else if (stmt.isBlockStmt()) { |
|
|
|
NodeList<Statement> stmts = stmt.asBlockStmt().getStatements(); |
|
|
|
var stmts = stmt.asBlockStmt().getStatements(); |
|
|
|
if (stmts.size() == 1) { |
|
|
|
if (stmts.size() == 1) { |
|
|
|
Statement head = stmts.get(0); |
|
|
|
Statement head = stmts.get(0); |
|
|
|
if (head.isIfStmt()) { |
|
|
|
if (head.isIfStmt()) { |
|
|
|