diff options
author | Stiver <stiver.mail@gmail.com> | 2014-09-28 09:14:59 +0200 |
---|---|---|
committer | Stiver <stiver.mail@gmail.com> | 2014-09-28 09:14:59 +0200 |
commit | 4638144fad4a887058c81eea058836372380de0c (patch) | |
tree | 89b50433a0ee3737f72e142f917a37854af87c7c /src/org/jetbrains | |
parent | f875d27e6e2086888cc3c4d837872b11b58dd8fc (diff) | |
download | fernflower-4638144fad4a887058c81eea058836372380de0c.tar fernflower-4638144fad4a887058c81eea058836372380de0c.tar.gz fernflower-4638144fad4a887058c81eea058836372380de0c.tar.lz fernflower-4638144fad4a887058c81eea058836372380de0c.tar.xz fernflower-4638144fad4a887058c81eea058836372380de0c.zip |
Fixing migration errors: refactoring of processStatementLabel() reverted as it introduced incorrect logic changes
Diffstat (limited to 'src/org/jetbrains')
-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) { |