refactor: add static methods for create DotGraphVisitor
This commit is contained in:
@@ -59,7 +59,7 @@ public class Jadx {
|
||||
passes.add(new DebugInfoVisitor());
|
||||
passes.add(new TypeInference());
|
||||
if (args.isRawCFGOutput()) {
|
||||
passes.add(new DotGraphVisitor(outDir, false, true));
|
||||
passes.add(DotGraphVisitor.dumpRaw(outDir));
|
||||
}
|
||||
|
||||
passes.add(new ConstInlinerVisitor());
|
||||
@@ -72,7 +72,7 @@ public class Jadx {
|
||||
passes.add(new CodeShrinker());
|
||||
passes.add(new ReSugarCode());
|
||||
if (args.isCFGOutput()) {
|
||||
passes.add(new DotGraphVisitor(outDir, false));
|
||||
passes.add(DotGraphVisitor.dump(outDir));
|
||||
}
|
||||
|
||||
passes.add(new RegionMakerVisitor());
|
||||
@@ -85,7 +85,7 @@ public class Jadx {
|
||||
passes.add(new CheckRegions());
|
||||
|
||||
if (args.isCFGOutput()) {
|
||||
passes.add(new DotGraphVisitor(outDir, true));
|
||||
passes.add(DotGraphVisitor.dumpRegions(outDir));
|
||||
}
|
||||
|
||||
passes.add(new MethodInlineVisitor());
|
||||
|
||||
@@ -30,16 +30,28 @@ public class DotGraphVisitor extends AbstractVisitor {
|
||||
private final boolean useRegions;
|
||||
private final boolean rawInsn;
|
||||
|
||||
public DotGraphVisitor(File outDir, boolean useRegions, boolean rawInsn) {
|
||||
public static DotGraphVisitor dump(File outDir) {
|
||||
return new DotGraphVisitor(outDir, false, false);
|
||||
}
|
||||
|
||||
public static DotGraphVisitor dumpRaw(File outDir) {
|
||||
return new DotGraphVisitor(outDir, false, true);
|
||||
}
|
||||
|
||||
public static DotGraphVisitor dumpRegions(File outDir) {
|
||||
return new DotGraphVisitor(outDir, true, false);
|
||||
}
|
||||
|
||||
public static DotGraphVisitor dumpRawRegions(File outDir) {
|
||||
return new DotGraphVisitor(outDir, true, true);
|
||||
}
|
||||
|
||||
private DotGraphVisitor(File outDir, boolean useRegions, boolean rawInsn) {
|
||||
this.dir = outDir;
|
||||
this.useRegions = useRegions;
|
||||
this.rawInsn = rawInsn;
|
||||
}
|
||||
|
||||
public DotGraphVisitor(File outDir, boolean useRegions) {
|
||||
this(outDir, useRegions, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(MethodNode mth) {
|
||||
if (mth.isNoCode()) {
|
||||
|
||||
Reference in New Issue
Block a user