Пример #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;
   }
 }
Пример #2
0
 @Override
 public void visit(StringConstantInstruction insn) {
   assign(Expr.constant(insn.getConstant()), insn.getReceiver());
 }
Пример #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;
 }
Пример #4
0
 private Expr castToInteger(Expr value) {
   return Expr.binary(BinaryOperation.BITWISE_OR, value, Expr.constant(0));
 }
Пример #5
0
 @Override
 public void visit(NullConstantInstruction insn) {
   assign(Expr.constant(null), insn.getReceiver());
 }