use of jadx.core.dex.regions.SwitchRegion.CaseInfo in project jadx by skylot.
the class RegionGen method makeSwitch.
public void makeSwitch(SwitchRegion sw, ICodeWriter code) throws CodegenException {
SwitchInsn insn = (SwitchInsn) BlockUtils.getLastInsn(sw.getHeader());
Objects.requireNonNull(insn, "Switch insn not found in header");
InsnArg arg = insn.getArg(0);
code.startLine("switch (");
addArg(code, arg, false);
code.add(") {");
InsnCodeOffset.attach(code, insn);
CodeGenUtils.addCodeComments(code, mth, insn);
code.incIndent();
for (CaseInfo caseInfo : sw.getCases()) {
List<Object> keys = caseInfo.getKeys();
IContainer c = caseInfo.getContainer();
for (Object k : keys) {
if (k == SwitchRegion.DEFAULT_CASE_KEY) {
code.startLine("default:");
} else {
code.startLine("case ");
addCaseKey(code, arg, k);
code.add(':');
}
}
makeRegionIndent(code, c);
}
code.decIndent();
code.startLine('}');
}
Aggregations