org.codehaus.groovy.ast.expr.BitwiseNegationExpression Java Examples

The following examples show how to use org.codehaus.groovy.ast.expr.BitwiseNegationExpression. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ASTNodeVisitor.java    From groovy-language-server with Apache License 2.0 5 votes vote down vote up
public void visitBitwiseNegationExpression(BitwiseNegationExpression node) {
	pushASTNode(node);
	try {
		super.visitBitwiseNegationExpression(node);
	} finally {
		popASTNode();
	}
}
 
Example #2
Source File: UnaryExpressionHelper.java    From groovy with Apache License 2.0 5 votes vote down vote up
public void writeBitwiseNegate(BitwiseNegationExpression expression) {
    Expression subExpression = expression.getExpression();
    subExpression.visit(controller.getAcg());
    controller.getOperandStack().box();
    bitwiseNegate.call(controller.getMethodVisitor());
    controller.getOperandStack().replace(ClassHelper.OBJECT_TYPE);
    controller.getAssertionWriter().record(expression);
}
 
Example #3
Source File: StaticTypesUnaryExpressionHelper.java    From groovy with Apache License 2.0 5 votes vote down vote up
@Override
public void writeBitwiseNegate(final BitwiseNegationExpression expression) {
    expression.getExpression().visit(controller.getAcg());
    if (isPrimitiveOnTop()) {
        ClassNode top = getTopOperand();
        if (top == int_TYPE || top == short_TYPE || top == byte_TYPE || top == char_TYPE || top == long_TYPE) {
            BytecodeExpression bytecodeExpression = bytecodeX(mv -> {
                if (long_TYPE == top) {
                    mv.visitLdcInsn(-1);
                    mv.visitInsn(LXOR);
                } else {
                    mv.visitInsn(ICONST_M1);
                    mv.visitInsn(IXOR);
                    if (byte_TYPE == top) {
                        mv.visitInsn(I2B);
                    } else if (char_TYPE == top) {
                        mv.visitInsn(I2C);
                    } else if (short_TYPE == top) {
                        mv.visitInsn(I2S);
                    }
                }
            });
            bytecodeExpression.visit(controller.getAcg());
            controller.getOperandStack().remove(1);
            return;
        }
    }
    super.writeBitwiseNegate(EMPTY_BITWISE_NEGATE);
}
 
Example #4
Source File: PathFinderVisitor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(BitwiseNegationExpression node) {
    if (isInside(node, line, column)) {
        super.visitBitwiseNegationExpression(node);
    }
}
 
Example #5
Source File: ASTFinder.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(final BitwiseNegationExpression expression) {
    super.visitBitwiseNegationExpression(expression);
    tryFind(BitwiseNegationExpression.class, expression);
}
 
Example #6
Source File: ContextualClassCodeVisitor.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(final BitwiseNegationExpression expression) {
    pushContext(expression);
    super.visitBitwiseNegationExpression(expression);
    popContext();
}
 
Example #7
Source File: SecureASTCustomizer.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(final BitwiseNegationExpression expression) {
    assertExpressionAuthorized(expression);
    expression.getExpression().visit(this);
}
 
Example #8
Source File: TransformingCodeVisitor.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(final BitwiseNegationExpression expression) {
    super.visitBitwiseNegationExpression(expression);
    trn.visitBitwiseNegationExpression(expression);
}
 
Example #9
Source File: CodeVisitorSupport.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(BitwiseNegationExpression expression) {
    expression.getExpression().visit(this);
}
 
Example #10
Source File: AsmClassGenerator.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(final BitwiseNegationExpression expression) {
    controller.getUnaryExpressionHelper().writeBitwiseNegate(expression);
}
 
Example #11
Source File: OptimizingStatementWriter.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void visitBitwiseNegationExpression(final BitwiseNegationExpression expression) {
    // TODO: implement int operations for this
    super.visitBitwiseNegationExpression(expression);
    addMeta(expression).type = OBJECT_TYPE;
}
 
Example #12
Source File: GroovyCodeVisitor.java    From groovy with Apache License 2.0 votes vote down vote up
void visitBitwiseNegationExpression(BitwiseNegationExpression expression);