Search in sources :

Example 91 with BinaryExpression

use of org.codehaus.groovy.ast.expr.BinaryExpression in project groovy by apache.

the class EqualsAndHashCodeASTTransformation method differentSelfRecursiveFieldX.

private static BinaryExpression differentSelfRecursiveFieldX(FieldNode fNode, Expression other) {
    final Expression fieldExpr = varX(fNode);
    final Expression otherExpr = propX(other, fNode.getName());
    return orX(andX(sameX(fieldExpr, varX("this")), notX(sameX(otherExpr, other))), andX(notX(sameX(fieldExpr, varX("this"))), sameX(otherExpr, other)));
}
Also used : Expression(org.codehaus.groovy.ast.expr.Expression) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) CastExpression(org.codehaus.groovy.ast.expr.CastExpression)

Example 92 with BinaryExpression

use of org.codehaus.groovy.ast.expr.BinaryExpression in project groovy by apache.

the class FieldASTTransformation method visitExpressionStatement.

@Override
public void visitExpressionStatement(ExpressionStatement es) {
    Expression exp = es.getExpression();
    if (exp instanceof BinaryExpression) {
        exp.visit(this);
    }
    super.visitExpressionStatement(es);
}
Also used : BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) Expression(org.codehaus.groovy.ast.expr.Expression) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) DeclarationExpression(org.codehaus.groovy.ast.expr.DeclarationExpression) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression)

Example 93 with BinaryExpression

use of org.codehaus.groovy.ast.expr.BinaryExpression in project gcontracts by andresteingress.

the class Assertion method and.

public void and(T other) {
    Validate.notNull(other);
    BooleanExpression newBooleanExpression = new BooleanExpression(new BinaryExpression(booleanExpression(), Token.newSymbol(Types.LOGICAL_AND, -1, -1), other.booleanExpression()));
    newBooleanExpression.setSourcePosition(booleanExpression());
    renew(newBooleanExpression);
}
Also used : BooleanExpression(org.codehaus.groovy.ast.expr.BooleanExpression) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression)

Aggregations

BinaryExpression (org.codehaus.groovy.ast.expr.BinaryExpression)93 VariableExpression (org.codehaus.groovy.ast.expr.VariableExpression)82 Expression (org.codehaus.groovy.ast.expr.Expression)70 ConstantExpression (org.codehaus.groovy.ast.expr.ConstantExpression)56 MethodCallExpression (org.codehaus.groovy.ast.expr.MethodCallExpression)50 ArgumentListExpression (org.codehaus.groovy.ast.expr.ArgumentListExpression)49 PropertyExpression (org.codehaus.groovy.ast.expr.PropertyExpression)47 ClassExpression (org.codehaus.groovy.ast.expr.ClassExpression)38 TupleExpression (org.codehaus.groovy.ast.expr.TupleExpression)35 BooleanExpression (org.codehaus.groovy.ast.expr.BooleanExpression)33 ClassNode (org.codehaus.groovy.ast.ClassNode)31 TernaryExpression (org.codehaus.groovy.ast.expr.TernaryExpression)29 EmptyExpression (org.codehaus.groovy.ast.expr.EmptyExpression)28 FieldExpression (org.codehaus.groovy.ast.expr.FieldExpression)28 ListExpression (org.codehaus.groovy.ast.expr.ListExpression)25 DeclarationExpression (org.codehaus.groovy.ast.expr.DeclarationExpression)23 ExpressionStatement (org.codehaus.groovy.ast.stmt.ExpressionStatement)21 ArrayExpression (org.codehaus.groovy.ast.expr.ArrayExpression)20 CastExpression (org.codehaus.groovy.ast.expr.CastExpression)20 ClosureExpression (org.codehaus.groovy.ast.expr.ClosureExpression)19