Exemplo n.º 1
0
 @Override
 public void visit(BranchingInstruction insn) {
   switch (insn.getCondition()) {
     case EQUAL:
       branch(
           compare(BinaryOperation.EQUALS, insn.getOperand()),
           insn.getConsequent(),
           insn.getAlternative());
       break;
     case NOT_EQUAL:
       branch(
           compare(BinaryOperation.NOT_EQUALS, insn.getOperand()),
           insn.getConsequent(),
           insn.getAlternative());
       break;
     case GREATER:
       branch(
           compare(BinaryOperation.GREATER, insn.getOperand()),
           insn.getConsequent(),
           insn.getAlternative());
       break;
     case GREATER_OR_EQUAL:
       branch(
           compare(BinaryOperation.GREATER_OR_EQUALS, insn.getOperand()),
           insn.getConsequent(),
           insn.getAlternative());
       break;
     case LESS:
       branch(
           compare(BinaryOperation.LESS, insn.getOperand()),
           insn.getConsequent(),
           insn.getAlternative());
       break;
     case LESS_OR_EQUAL:
       branch(
           compare(BinaryOperation.LESS_OR_EQUALS, insn.getOperand()),
           insn.getConsequent(),
           insn.getAlternative());
       break;
     case NOT_NULL:
       branch(
           Expr.binary(
               BinaryOperation.STRICT_NOT_EQUALS,
               Expr.var(insn.getOperand().getIndex()),
               Expr.constant(null)),
           insn.getConsequent(),
           insn.getAlternative());
       break;
     case NULL:
       branch(
           Expr.binary(
               BinaryOperation.STRICT_EQUALS,
               Expr.var(insn.getOperand().getIndex()),
               Expr.constant(null)),
           insn.getConsequent(),
           insn.getAlternative());
       break;
   }
 }
Exemplo n.º 2
0
 @Override
 public void visit(StringConstantInstruction insn) {
   assign(Expr.constant(insn.getConstant()), insn.getReceiver());
 }
Exemplo n.º 3
0
 private Expr compare(BinaryOperation op, Variable value) {
   Expr expr = Expr.binary(op, Expr.var(value.getIndex()), Expr.constant(0));
   expr.setLocation(currentLocation);
   return expr;
 }
Exemplo n.º 4
0
 private Expr castToInteger(Expr value) {
   return Expr.binary(BinaryOperation.BITWISE_OR, value, Expr.constant(0));
 }
Exemplo n.º 5
0
 @Override
 public void visit(NullConstantInstruction insn) {
   assign(Expr.constant(null), insn.getReceiver());
 }