Skip to content

Commit ee4d12c

Browse files
authored
Fix eliminated loops removing successor (#101)
* Fix eliminated loops removing successor Also removes the temporary fix, as the problem is fixed at its root instead
1 parent e37532b commit ee4d12c

10 files changed

Lines changed: 7 additions & 103 deletions

FernFlower-Patches/0009-LVT-Fixes-and-Support-for-Enhanced-For-loop-detectio.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ index 86cac9e08f0f0d3ebd43353b64eba9560279de55..038dac26540f41092afd009369546705
453453

454454
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java
455455
new file mode 100644
456-
index 0000000000000000000000000000000000000000..8f7984ec00e84aeca1902484f8f9b43c1fe81cf6
456+
index 0000000000000000000000000000000000000000..82c960ee29c4babfe77381df3a4a46716c68e401
457457
--- /dev/null
458458
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java
459459
@@ -0,0 +1,199 @@
@@ -636,6 +636,12 @@ index 0000000000000000000000000000000000000000..8f7984ec00e84aeca1902484f8f9b43c
636636
+
637637
+ private static void eliminateLoop(Statement loop, Statement parentloop) {
638638
+
639+
+ // remove the last break edge, if exists
640+
+ Statement loopcontent = loop.getFirst();
641+
+ if (!loopcontent.getSuccessorEdges(StatEdge.EdgeType.BREAK).isEmpty()) {
642+
+ loopcontent.removeSuccessor(loopcontent.getSuccessorEdges(StatEdge.EdgeType.BREAK).get(0));
643+
+ }
644+
+
639645
+ // move continue edges to the parent loop
640646
+ List<StatEdge> lst = new ArrayList<>(loop.getLabelEdges());
641647
+ for (StatEdge edge : lst) {
@@ -646,12 +652,6 @@ index 0000000000000000000000000000000000000000..8f7984ec00e84aeca1902484f8f9b43c
646652
+ parentloop.addLabeledEdge(edge);
647653
+ }
648654
+
649-
+ // remove the last break edge, if exists
650-
+ Statement loopcontent = loop.getFirst();
651-
+ if (!loopcontent.getAllSuccessorEdges().isEmpty()) {
652-
+ loopcontent.removeSuccessor(loopcontent.getAllSuccessorEdges().get(0));
653-
+ }
654-
+
655655
+ // replace loop with its content
656656
+ loop.getParent().replaceStatement(loop, loopcontent);
657657
+ }

FernFlower-Patches/0042-Fix-compound-assignments.patch renamed to FernFlower-Patches/0041-Fix-compound-assignments.patch

File renamed without changes.

FernFlower-Patches/0041-Temporary-fix-for-a-loop-inlining-failure.patch

Lines changed: 0 additions & 96 deletions
This file was deleted.

FernFlower-Patches/0043-Filter-out-generated-Record-getters-and-constructor..patch renamed to FernFlower-Patches/0042-Filter-out-generated-Record-getters-and-constructor..patch

File renamed without changes.

FernFlower-Patches/0044-Fix-variables-in-finally-blocks-not-getting-renamed.patch renamed to FernFlower-Patches/0043-Fix-variables-in-finally-blocks-not-getting-renamed.patch

File renamed without changes.

FernFlower-Patches/0045-Search-generics-when-finding-where-to-inject-local-c.patch renamed to FernFlower-Patches/0044-Search-generics-when-finding-where-to-inject-local-c.patch

File renamed without changes.

FernFlower-Patches/0046-Reduce-allocations-in-getAllExprents.patch renamed to FernFlower-Patches/0045-Reduce-allocations-in-getAllExprents.patch

File renamed without changes.

FernFlower-Patches/0047-Cache-zip-file-instances-and-source-class-data.patch renamed to FernFlower-Patches/0046-Cache-zip-file-instances-and-source-class-data.patch

File renamed without changes.

FernFlower-Patches/0048-Fix-signature-polymorphic-methods.patch renamed to FernFlower-Patches/0047-Fix-signature-polymorphic-methods.patch

File renamed without changes.

FernFlower-Patches/0049-Improve-output-of-loops-inside-trycatch.patch renamed to FernFlower-Patches/0048-Improve-output-of-loops-inside-trycatch.patch

File renamed without changes.

0 commit comments

Comments
 (0)