use of com.googlecode.dex2jar.ir.LabelAndLocalMapper in project dex2jar by pxb1988.
the class ExceptionHandlerTrim method transform.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void transform(IrMethod irMethod) {
List<Trap> trips = irMethod.traps;
irMethod.traps = new ArrayList();
LabelAndLocalMapper map = new LabelAndLocalMapper() {
@Override
public LabelStmt map(LabelStmt label) {
return label;
}
};
for (Trap trap : trips) {
Trap ntrap = trap.clone(map);
int status = 0;
for (Stmt p = trap.start.getNext(); p != trap.end; p = p.getNext()) {
if (!Cfg.notThrow(p)) {
if (status == 0) {
Stmt pre = p.getPre();
if (pre == null || pre.st != ST.LABEL) {
pre = Stmts.nLabel();
irMethod.stmts.insertBefore(p, pre);
}
ntrap.start = (LabelStmt) pre;
status = 1;
} else if (status == 1) {
// continue;
}
} else if (status == 1) {
Stmt pre = p.getPre();
if (pre == null || pre.st != ST.LABEL) {
pre = Stmts.nLabel();
irMethod.stmts.insertBefore(p, pre);
}
ntrap.end = (LabelStmt) pre;
irMethod.traps.add(ntrap);
status = 0;
ntrap = trap.clone(map);
}
}
if (status == 1) {
ntrap.end = trap.end;
irMethod.traps.add(ntrap);
status = 0;
}
}
}
Aggregations