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

This commit is contained in:
Stiver 2014-09-28 09:14:59 +02:00
parent f875d27e6e
commit 4638144fad
1 changed files with 19 additions and 13 deletions

View File

@ -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) {