Remove issingle condition in matchFor

It produces rather ugly output where a while loop is more appropriate.
master
Graham 5 years ago
parent 4d46ef6312
commit 49c640733c
  1. 15
      src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java

@ -280,14 +280,7 @@ public class MergeHelper {
List<Exprent> lstExpr = lastData.getExprents();
lastDoExprent = lstExpr.get(lstExpr.size() - 1);
boolean issingle = false;
if (lstExpr.size() == 1) { // single exprent
if (lastData.getAllPredecessorEdges().size() > 1) { // break edges
issingle = true;
}
}
boolean haslast = issingle || lastDoExprent.type == Exprent.EXPRENT_ASSIGNMENT || lastDoExprent.type == Exprent.EXPRENT_FUNCTION;
boolean haslast = lastDoExprent.type == Exprent.EXPRENT_ASSIGNMENT || lastDoExprent.type == Exprent.EXPRENT_FUNCTION;
if (!haslast) {
return;
}
@ -323,7 +316,7 @@ public class MergeHelper {
}
}
if (hasinit || issingle) { // FIXME: issingle sufficient?
if (hasinit) {
Set<Statement> set = stat.getNeighboursSet(StatEdge.TYPE_CONTINUE, Statement.DIRECTION_BACKWARD);
set.remove(lastData);
@ -332,9 +325,7 @@ public class MergeHelper {
}
stat.setLooptype(DoStatement.LOOP_FOR);
if (hasinit) {
stat.setInitExprent(preData.getExprents().remove(preData.getExprents().size() - 1));
}
stat.setInitExprent(preData.getExprents().remove(preData.getExprents().size() - 1));
stat.setIncExprent(lastData.getExprents().remove(lastData.getExprents().size() - 1));
}

Loading…
Cancel
Save