Fixing migration errors: refactoring of processStatementLabel() reverted as it introduced incorrect logic changes

master
Stiver 10 years ago
parent f875d27e6e
commit 4638144fad
  1. 24
      src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java

@ -420,22 +420,26 @@ public class LabelHelper {
} }
} }
private static void processStatementLabel(Statement stat) { private static HashSet<Statement>[] processStatementLabel(Statement stat) {
processStatementLabel(stat, new HashSet<Statement>(), new HashSet<Statement>());
} HashSet<Statement> setBreak = new HashSet<Statement>();
HashSet<Statement> setContinue = new HashSet<Statement>();
private static void processStatementLabel(Statement stat, Set<Statement> setBreak, Set<Statement> setContinue) {
if (stat.getExprents() == null) { if (stat.getExprents() == null) {
for (Statement st : stat.getStats()) { for(Statement st : stat.getStats()) {
processStatementLabel(st, setBreak, setContinue); HashSet<Statement>[] arr = processStatementLabel(st);
setBreak.addAll(arr[0]);
setContinue.addAll(arr[1]);
} }
boolean shieldtype = (stat.type == Statement.TYPE_DO || stat.type == Statement.TYPE_SWITCH); boolean shieldtype = (stat.type == Statement.TYPE_DO || stat.type == Statement.TYPE_SWITCH);
for (StatEdge edge : stat.getLabelEdges()) { for(StatEdge edge : stat.getLabelEdges()) {
if (edge.explicit) { if (edge.explicit) {
if (shieldtype && ((edge.getType() == StatEdge.TYPE_BREAK && setBreak.contains(edge.getSource())) || if (shieldtype
(edge.getType() == StatEdge.TYPE_CONTINUE && setContinue.contains(edge.getSource())))) { && ((edge.getType() == StatEdge.TYPE_BREAK && setBreak.contains(edge.getSource())) || (edge.getType() == StatEdge.TYPE_CONTINUE && setContinue.contains(edge
.getSource())))) {
edge.labeled = false; edge.labeled = false;
} }
} }
@ -451,6 +455,8 @@ public class LabelHelper {
setBreak.add(stat); setBreak.add(stat);
setContinue.add(stat); setContinue.add(stat);
return new HashSet[] { setBreak, setContinue };
} }
public static void replaceContinueWithBreak(Statement stat) { public static void replaceContinueWithBreak(Statement stat) {

Loading…
Cancel
Save