diff options
-rw-r--r-- | src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java index 1f4b5ee..4821eab 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java @@ -420,37 +420,43 @@ public class LabelHelper { } } - private static void processStatementLabel(Statement stat) { - processStatementLabel(stat, new HashSet<Statement>(), new HashSet<Statement>()); - } + private static HashSet<Statement>[] processStatementLabel(Statement stat) { + + 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) { - for (Statement st : stat.getStats()) { - processStatementLabel(st, setBreak, setContinue); + for(Statement st : stat.getStats()) { + 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); - for (StatEdge edge : stat.getLabelEdges()) { + for(StatEdge edge : stat.getLabelEdges()) { if (edge.explicit) { - if (shieldtype && ((edge.getType() == StatEdge.TYPE_BREAK && setBreak.contains(edge.getSource())) || - (edge.getType() == StatEdge.TYPE_CONTINUE && setContinue.contains(edge.getSource())))) { + if (shieldtype + && ((edge.getType() == StatEdge.TYPE_BREAK && setBreak.contains(edge.getSource())) || (edge.getType() == StatEdge.TYPE_CONTINUE && setContinue.contains(edge + .getSource())))) { edge.labeled = false; } } } switch (stat.type) { - case Statement.TYPE_DO: - setContinue.clear(); - case Statement.TYPE_SWITCH: - setBreak.clear(); + case Statement.TYPE_DO: + setContinue.clear(); + case Statement.TYPE_SWITCH: + setBreak.clear(); } } setBreak.add(stat); setContinue.add(stat); + + return new HashSet[] { setBreak, setContinue }; } public static void replaceContinueWithBreak(Statement stat) { |