Exemple #1
0
  private void printStatementsInBody(Body body, java.io.PrintWriter out) {

    if (Options.v().verbose()) System.out.println("Printing " + body.getMethod().getName());

    Chain<Unit> units = ((DavaBody) body).getUnits();

    if (units.size() != 1) {
      throw new RuntimeException("DavaBody AST doesn't have single root.");
    }

    UnitPrinter up = new DavaUnitPrinter((DavaBody) body);
    ((ASTNode) units.getFirst()).toString(up);
    out.print(up.toString());
  }
Exemple #2
0
  public void toString(UnitPrinter up) {
    up.literal(Jimple.DYNAMICINVOKE);
    up.literal(
        " \""
            + methodRef.name()
            + "\" <"
            + SootMethod.getSubSignature(
                "" /* no method name here*/, methodRef.parameterTypes(), methodRef.returnType())
            + ">(");

    for (int i = 0; i < argBoxes.length; i++) {
      if (i != 0) up.literal(", ");

      argBoxes[i].toString(up);
    }

    up.literal(") ");
    up.methodRef(bsmRef);
    up.literal("(");

    for (int i = 0; i < bsmArgBoxes.length; i++) {
      if (i != 0) up.literal(", ");

      bsmArgBoxes[i].toString(up);
    }

    up.literal(")");
  }
  public void toString(UnitPrinter up) {
    up.literal("new");
    up.literal(" ");
    up.type(getBaseType().baseType);
    for (ValueBox element : sizeBoxes) {
      up.literal("[");
      element.toString(up);
      up.literal("]");
    }

    for (int i = getSizeCount(); i < getBaseType().numDimensions; i++) up.literal("[]");
  }
  public void toString(UnitPrinter up) {
    up.literal(Jimple.v().STATICINVOKE);
    up.literal(" ");
    up.methodRef(methodRef);
    up.literal("(");

    for (int i = 0; i < argBoxes.size(); i++) {
      if (i != 0) up.literal(", ");

      getArgBox(i).toString(up);
    }

    up.literal(")");
  }
Exemple #5
0
 public void toString(UnitPrinter up) {
   up.local(this);
 }
Exemple #6
0
 public void toString(UnitPrinter up) {
   up.fieldRef(fieldRef);
 }
Exemple #7
0
  public void toString(UnitPrinter up) {
    label_toString(up);

    up.literal("switch");
    up.literal(" ");
    up.literal("(");
    keyBox.toString(up);
    up.literal(")");
    up.newline();

    up.literal("{");
    up.newline();

    Iterator<Object> it = indexList.iterator();
    while (it.hasNext()) {

      Object index = it.next();

      up.incIndent();

      if (index instanceof String) up.literal("default");
      else {
        up.literal("case");
        up.literal(" ");
        up.literal(index.toString());
      }

      up.literal(":");
      up.newline();

      List<Object> subBody = index2BodyList.get(index);

      if (subBody != null) {
        up.incIndent();
        body_toString(up, subBody);

        if (it.hasNext()) up.newline();
        up.decIndent();
      }
      up.decIndent();
    }

    up.literal("}");
    up.newline();
  }
Exemple #8
0
 public void toString(UnitPrinter up) {
   up.literal(Jimple.THROW);
   up.literal(" ");
   opBox.toString(up);
 }