Search in sources :

Example 1 with AssignmentExpression

use of com.strobel.decompiler.languages.java.ast.AssignmentExpression in project j2objc by google.

the class MethodTranslator method visitAssignmentExpression.

@Override
public TreeNode visitAssignmentExpression(AssignmentExpression node, Void data) {
    Expression leftExpr = (Expression) node.getLeft().acceptVisitor(this, null);
    Expression rightExpr = (Expression) node.getRight().acceptVisitor(this, null);
    Assignment assignment = new Assignment(leftExpr, rightExpr);
    switch(node.getOperator()) {
        case ASSIGN:
            assignment.setOperator(Assignment.Operator.ASSIGN);
            break;
        case ADD:
            assignment.setOperator(Assignment.Operator.PLUS_ASSIGN);
            break;
        case SUBTRACT:
            assignment.setOperator(Assignment.Operator.MINUS_ASSIGN);
            break;
        case MULTIPLY:
            assignment.setOperator(Assignment.Operator.TIMES_ASSIGN);
            break;
        case DIVIDE:
            assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN);
            break;
        case MODULUS:
            assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN);
            break;
        case SHIFT_LEFT:
            assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN);
            break;
        case SHIFT_RIGHT:
            assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN);
            break;
        case UNSIGNED_SHIFT_RIGHT:
            assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN);
            break;
        case BITWISE_AND:
            assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN);
            break;
        case BITWISE_OR:
            assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN);
            break;
        case EXCLUSIVE_OR:
            assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN);
            break;
        default:
            throw new AssertionError("Unsupported assignment operator: " + node.getOperator());
    }
    return assignment;
}
Also used : Assignment(com.google.devtools.j2objc.ast.Assignment) SuperReferenceExpression(com.strobel.decompiler.languages.java.ast.SuperReferenceExpression) PostfixExpression(com.google.devtools.j2objc.ast.PostfixExpression) AnonymousObjectCreationExpression(com.strobel.decompiler.languages.java.ast.AnonymousObjectCreationExpression) Expression(com.google.devtools.j2objc.ast.Expression) TypeReferenceExpression(com.strobel.decompiler.languages.java.ast.TypeReferenceExpression) UnaryOperatorExpression(com.strobel.decompiler.languages.java.ast.UnaryOperatorExpression) ConditionalExpression(com.google.devtools.j2objc.ast.ConditionalExpression) BinaryOperatorExpression(com.strobel.decompiler.languages.java.ast.BinaryOperatorExpression) ClassOfExpression(com.strobel.decompiler.languages.java.ast.ClassOfExpression) ThisReferenceExpression(com.strobel.decompiler.languages.java.ast.ThisReferenceExpression) AssignmentExpression(com.strobel.decompiler.languages.java.ast.AssignmentExpression) InfixExpression(com.google.devtools.j2objc.ast.InfixExpression) PrimitiveExpression(com.strobel.decompiler.languages.java.ast.PrimitiveExpression) ParenthesizedExpression(com.google.devtools.j2objc.ast.ParenthesizedExpression) MemberReferenceExpression(com.strobel.decompiler.languages.java.ast.MemberReferenceExpression) PrefixExpression(com.google.devtools.j2objc.ast.PrefixExpression) ObjectCreationExpression(com.strobel.decompiler.languages.java.ast.ObjectCreationExpression) InvocationExpression(com.strobel.decompiler.languages.java.ast.InvocationExpression) ThisExpression(com.google.devtools.j2objc.ast.ThisExpression) ArrayCreationExpression(com.strobel.decompiler.languages.java.ast.ArrayCreationExpression) MethodGroupExpression(com.strobel.decompiler.languages.java.ast.MethodGroupExpression) IdentifierExpression(com.strobel.decompiler.languages.java.ast.IdentifierExpression) IndexerExpression(com.strobel.decompiler.languages.java.ast.IndexerExpression) NullReferenceExpression(com.strobel.decompiler.languages.java.ast.NullReferenceExpression) ArrayInitializerExpression(com.strobel.decompiler.languages.java.ast.ArrayInitializerExpression) VariableDeclarationExpression(com.google.devtools.j2objc.ast.VariableDeclarationExpression)

Aggregations

Assignment (com.google.devtools.j2objc.ast.Assignment)1 ConditionalExpression (com.google.devtools.j2objc.ast.ConditionalExpression)1 Expression (com.google.devtools.j2objc.ast.Expression)1 InfixExpression (com.google.devtools.j2objc.ast.InfixExpression)1 ParenthesizedExpression (com.google.devtools.j2objc.ast.ParenthesizedExpression)1 PostfixExpression (com.google.devtools.j2objc.ast.PostfixExpression)1 PrefixExpression (com.google.devtools.j2objc.ast.PrefixExpression)1 ThisExpression (com.google.devtools.j2objc.ast.ThisExpression)1 VariableDeclarationExpression (com.google.devtools.j2objc.ast.VariableDeclarationExpression)1 AnonymousObjectCreationExpression (com.strobel.decompiler.languages.java.ast.AnonymousObjectCreationExpression)1 ArrayCreationExpression (com.strobel.decompiler.languages.java.ast.ArrayCreationExpression)1 ArrayInitializerExpression (com.strobel.decompiler.languages.java.ast.ArrayInitializerExpression)1 AssignmentExpression (com.strobel.decompiler.languages.java.ast.AssignmentExpression)1 BinaryOperatorExpression (com.strobel.decompiler.languages.java.ast.BinaryOperatorExpression)1 ClassOfExpression (com.strobel.decompiler.languages.java.ast.ClassOfExpression)1 IdentifierExpression (com.strobel.decompiler.languages.java.ast.IdentifierExpression)1 IndexerExpression (com.strobel.decompiler.languages.java.ast.IndexerExpression)1 InvocationExpression (com.strobel.decompiler.languages.java.ast.InvocationExpression)1 MemberReferenceExpression (com.strobel.decompiler.languages.java.ast.MemberReferenceExpression)1 MethodGroupExpression (com.strobel.decompiler.languages.java.ast.MethodGroupExpression)1