/**
   * Generates a new <code>OpLogical</code> AST node representing the binary logical operation.
   *
   * @param exp will hold the <code>OpLogical</code>
   */
  public void apply(ExpressionPtr exp) {

    int operator_id = getOpId(exp.op().getTerminalId());
    String operator_image = getOpImage(operator_id);
    ExpressionNode logicalOp =
        new OpLogical(resultType, operator_id, operator_image, exp.get(0), exp.get(1));
    exp.set(logicalOp);
  }
Beispiel #2
0
  /**
   * Is the indicated operand or exp of the same type as <code>type</code> ?
   *
   * @param exp expression
   * @return <code>true</code> if indicated operand or exp is of the same type as <code>type</code>,
   *     <code>false</code> otherwise.
   */
  public boolean applies(ExpressionPtr exp) {
    boolean result = false;
    TypeNode t = exp.get_base_type(start);

    // ?? do we need to dereference ?

    if (t instanceof TyAbstractPointer) {
      // test for equality - distinguish between pointer and reference
      result = type.equals(t.getClass());
    } else {
      // test for inheritance or equality
      result = type.isAssignableFrom(t.getClass());
    }

    return result;
  }
 protected ExpressionNode applyExp(ScopedName op, Object[] operands) {
   ExpressionPtr exp = new ExpressionPtr(op, operands);
   eb.apply(exp);
   return exp.get();
 }