core: fix processing try/catch in loop
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user