提交 66e6613d 编写于 作者: S Skylot

wip: handle empty loop body (#1040)

上级 5c75f249
......@@ -224,7 +224,12 @@ public class RegionMaker {
}
stack.addExit(out);
BlockNode loopBody = condInfo.getThenBlock();
Region body = makeRegion(loopBody, stack);
Region body;
if (loopBody.contains(AFlag.LOOP_START)) {
body = new Region(loopRegion);
} else {
body = makeRegion(loopBody, stack);
}
// add blocks from loop start to first condition block
BlockNode conditionBlock = condInfo.getIfBlock();
if (loopStart != conditionBlock) {
......
package jadx.tests.integration.trycatch;
import jadx.tests.api.SmaliTest;
import org.junit.jupiter.api.Test;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
public class TestLoopInTryCatch extends SmaliTest {
@Test
public void test() {
assertThat(getClassNodeFromSmali())
.code()
.containsOne("while (");
}
}
.class public Ltrycatch/TestLoopInTryCatch;
.super Ljava/lang/Object;
.source "SourceFile"
.method public static test()V
.registers 6
:try_start
:loop
const/4 v1, 0x0
const/4 v2, 0x1
if-eq v1, v2, :cond
const/4 v3, 0x2
if-eq v1, v3, :cond
goto :loop
:cond
if-eq v1, v2, :end
return-void
:try_end
.catch Ljava/io/IOException; {:try_start .. :try_end} :end
:end
return-void
.end method
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册