コード例 #1
0
  @Override
  public void visitDivideExpression(JDivideExpression self) {

    if (isIntegerValue(self.left()) && isNumberLiteral2(self.right())) {

      self.left().accept(this);
      JExpression left = this.getArrayStack().pop();

      JOrdinalLiteral literalIntegerOne = createNumberOne(self);

      JShiftExpression shiftExpr =
          new JShiftExpression(self.getTokenReference(), Constants.OPE_SR, left, literalIntegerOne);
      this.getArrayStack().push(shiftExpr);
    } else {
      super.visitDivideExpression(self);
    }
  }
コード例 #2
0
 private JOrdinalLiteral createNumberOne(JDivideExpression self) {
   JOrdinalLiteral numberOne =
       new JOrdinalLiteral(
           self.getTokenReference(), new Integer(1), (CNumericType) self.getType());
   return numberOne;
 }