提交 d2811263 编写于 作者: S Skylot

core: fix processing try/catch in loop

上级 4fb6ada5
......@@ -20,7 +20,7 @@ public final class LoopRegion extends AbstractRegion {
private final BlockNode conditionBlock;
// instruction which must be executed before condition in every loop
private BlockNode preCondition;
private IContainer body;
private IRegion body;
private final boolean conditionAtEnd;
private LoopType type;
......@@ -44,11 +44,11 @@ public final class LoopRegion extends AbstractRegion {
return conditionBlock;
}
public IContainer getBody() {
public IRegion getBody() {
return body;
}
public void setBody(IContainer body) {
public void setBody(IRegion body) {
this.body = body;
}
......@@ -144,6 +144,11 @@ public final class LoopRegion extends AbstractRegion {
return Collections.unmodifiableList(all);
}
@Override
public boolean replaceSubBlock(IContainer oldBlock, IContainer newBlock) {
return false;
}
@Override
public String baseString() {
return body.baseString();
......
......@@ -7,6 +7,7 @@ import jadx.core.dex.nodes.IRegion;
import jadx.core.dex.nodes.MethodNode;
import jadx.core.dex.regions.AbstractRegion;
import jadx.core.dex.regions.Region;
import jadx.core.dex.regions.loops.LoopRegion;
import jadx.core.dex.trycatch.CatchAttr;
import jadx.core.dex.trycatch.ExceptionHandler;
import jadx.core.dex.trycatch.TryCatchBlock;
......@@ -121,7 +122,13 @@ public class ProcessTryCatchRegions extends AbstractRegionVisitor {
/**
* Extract all block dominated by 'dominator' to separate region and mark as try/catch block
*/
private static boolean wrapBlocks(IRegion region, TryCatchBlock tb, BlockNode dominator) {
private static boolean wrapBlocks(IRegion replaceRegion, TryCatchBlock tb, BlockNode dominator) {
IRegion region = replaceRegion;
if (region instanceof LoopRegion) {
LoopRegion loop = (LoopRegion) region;
region = loop.getBody();
}
Region newRegion = new Region(region);
List<IContainer> subBlocks = region.getSubBlocks();
for (IContainer cont : subBlocks) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册