Package jadx.core.dex.visitors.typeinference

Source Code of jadx.core.dex.visitors.typeinference.SelectTypeVisitor

package jadx.core.dex.visitors.typeinference;

import jadx.core.dex.instructions.args.ArgType;
import jadx.core.dex.instructions.args.InsnArg;
import jadx.core.dex.nodes.InsnNode;

public class SelectTypeVisitor {

  private SelectTypeVisitor() {
  }

  public static void visit(InsnNode insn) {
    InsnArg res = insn.getResult();
    if (res != null && !res.getType().isTypeKnown()) {
      selectType(res);
    }
    for (InsnArg arg : insn.getArguments()) {
      if (!arg.getType().isTypeKnown()) {
        selectType(arg);
      }
    }
  }

  private static void selectType(InsnArg arg) {
    ArgType t = arg.getType();
    ArgType newType = ArgType.merge(t, t.selectFirst());
    arg.setType(newType);
  }

}
TOP

Related Classes of jadx.core.dex.visitors.typeinference.SelectTypeVisitor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.