From 4638144fad4a887058c81eea058836372380de0c Mon Sep 17 00:00:00 2001 From: Stiver Date: Sun, 28 Sep 2014 09:14:59 +0200 Subject: Fixing migration errors: refactoring of processStatementLabel() reverted as it introduced incorrect logic changes --- .../decompiler/modules/decompiler/LabelHelper.java | 32 +++++++++++++--------- 1 file 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(), new HashSet()); - } + private static HashSet[] processStatementLabel(Statement stat) { + + HashSet setBreak = new HashSet(); + HashSet setContinue = new HashSet(); - private static void processStatementLabel(Statement stat, Set setBreak, Set setContinue) { if (stat.getExprents() == null) { - for (Statement st : stat.getStats()) { - processStatementLabel(st, setBreak, setContinue); + for(Statement st : stat.getStats()) { + HashSet[] 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) { -- cgit v1.2.3