mirror of
https://github.com/moparisthebest/fernflower
synced 2024-11-04 16:35:07 -05:00
Fixed 'IDEA-128593: Wrong order of switch cases'
This commit is contained in:
parent
de249340fc
commit
53ad2b920e
@ -266,15 +266,20 @@ public class SwitchStatement extends Statement {
|
|||||||
setPreds.remove(first);
|
setPreds.remove(first);
|
||||||
|
|
||||||
if(!setPreds.isEmpty()) {
|
if(!setPreds.isEmpty()) {
|
||||||
Statement pred = setPreds.iterator().next(); // at most one predecessor node besides the head
|
Statement pred = setPreds.iterator().next(); // assumption: at most one predecessor node besides the head. May not hold true for obfuscated code.
|
||||||
for(int j=index+1;j<nodes.size();j++) {
|
for(int j=0;j<nodes.size();j++) {
|
||||||
if(nodes.get(j) == pred) {
|
if(j != (index - 1) && nodes.get(j) == pred) {
|
||||||
nodes.add(j+1, stat);
|
nodes.add(j+1, stat);
|
||||||
edges.add(j+1, edges.get(index));
|
edges.add(j+1, edges.get(index));
|
||||||
|
|
||||||
|
if(j > index) {
|
||||||
nodes.remove(index);
|
nodes.remove(index);
|
||||||
edges.remove(index);
|
edges.remove(index);
|
||||||
index--;
|
index--;
|
||||||
|
} else {
|
||||||
|
nodes.remove(index + 1);
|
||||||
|
edges.remove(index + 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user