@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { parenthesizeIfRequired(node.getLeft(), ASSIGNMENT + 1); if (_insertParenthesesForReadability) { parenthesizeIfRequired(node.getRight(), RELATIONAL_AND_TYPE_TESTING + 1); } else { parenthesizeIfRequired(node.getRight(), ASSIGNMENT); } return super.visitAssignmentExpression(node, data); } }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { parenthesizeIfRequired(node.getLeft(), ASSIGNMENT + 1); if (_insertParenthesesForReadability) { parenthesizeIfRequired(node.getRight(), RELATIONAL_AND_TYPE_TESTING + 1); } else { parenthesizeIfRequired(node.getRight(), ASSIGNMENT); } return super.visitAssignmentExpression(node, data); } }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { parenthesizeIfRequired(node.getLeft(), ASSIGNMENT + 1); if (_insertParenthesesForReadability) { parenthesizeIfRequired(node.getRight(), RELATIONAL_AND_TYPE_TESTING + 1); } else { parenthesizeIfRequired(node.getRight(), ASSIGNMENT); } return super.visitAssignmentExpression(node, data); } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof AssignmentExpression) { final AssignmentExpression otherExpression = (AssignmentExpression) other; return !otherExpression.isNull() && (otherExpression._operator == _operator || _operator == AssignmentOperatorType.ANY || otherExpression._operator == AssignmentOperatorType.ANY) && getLeft().matches(otherExpression.getLeft(), match) && getRight().matches(otherExpression.getRight(), match); } return false; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof AssignmentExpression) { final AssignmentExpression otherExpression = (AssignmentExpression) other; return !otherExpression.isNull() && (otherExpression._operator == _operator || _operator == AssignmentOperatorType.ANY || otherExpression._operator == AssignmentOperatorType.ANY) && getLeft().matches(otherExpression.getLeft(), match) && getRight().matches(otherExpression.getRight(), match); } return false; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof AssignmentExpression) { final AssignmentExpression otherExpression = (AssignmentExpression) other; return !otherExpression.isNull() && (otherExpression._operator == _operator || _operator == AssignmentOperatorType.ANY || otherExpression._operator == AssignmentOperatorType.ANY) && getLeft().matches(otherExpression.getLeft(), match) && getRight().matches(otherExpression.getRight(), match); } return false; }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { super.visitAssignmentExpression(node, data); addCastForAssignment(node.getLeft(), node.getRight()); return null; }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { super.visitAssignmentExpression(node, data); addCastForAssignment(node.getLeft(), node.getRight()); return null; }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { super.visitAssignmentExpression(node, data); addCastForAssignment(node.getLeft(), node.getRight()); return null; }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { processPossibleTypeCast(node.getRight(), getType(node.getLeft())); return super.visitAssignmentExpression(node, data); }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { processPossibleTypeCast(node.getRight(), getType(node.getLeft())); return super.visitAssignmentExpression(node, data); }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void data) { processPossibleTypeCast(node.getRight(), getType(node.getLeft())); return super.visitAssignmentExpression(node, data); }
@Override public DefiniteAssignmentStatus visitAssignmentExpression(final AssignmentExpression node, final DefiniteAssignmentStatus data) { if (node.getOperator() == AssignmentOperatorType.ASSIGN) { return handleAssignment(node.getLeft(), node.getRight(), data); } else { return visitChildren(node, data); } }
@Override public DefiniteAssignmentStatus visitAssignmentExpression(final AssignmentExpression node, final DefiniteAssignmentStatus data) { if (node.getOperator() == AssignmentOperatorType.ASSIGN) { return handleAssignment(node.getLeft(), node.getRight(), data); } else { return visitChildren(node, data); } }
@Override public DefiniteAssignmentStatus visitAssignmentExpression(final AssignmentExpression node, final DefiniteAssignmentStatus data) { if (node.getOperator() == AssignmentOperatorType.ASSIGN) { return handleAssignment(node.getLeft(), node.getRight(), data); } else { return visitChildren(node, data); } }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void ignored) { startNode(node); node.getLeft().acceptVisitor(this, ignored); space(policy.SpaceAroundAssignment); writeToken(AssignmentExpression.getOperatorRole(node.getOperator())); space(policy.SpaceAroundAssignment); node.getRight().acceptVisitor(this, ignored); endNode(node); return null; }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void ignored) { startNode(node); node.getLeft().acceptVisitor(this, ignored); space(policy.SpaceAroundAssignment); writeToken(AssignmentExpression.getOperatorRole(node.getOperator())); space(policy.SpaceAroundAssignment); node.getRight().acceptVisitor(this, ignored); endNode(node); return null; }
@Override public Void visitAssignmentExpression(final AssignmentExpression node, final Void ignored) { startNode(node); node.getLeft().acceptVisitor(this, ignored); space(policy.SpaceAroundAssignment); writeToken(AssignmentExpression.getOperatorRole(node.getOperator())); space(policy.SpaceAroundAssignment); node.getRight().acceptVisitor(this, ignored); endNode(node); return null; }
private void inlineInitializers() { for (final String fieldName : _initializers.keySet()) { final FieldDeclaration declaration = _fieldDeclarations.get(fieldName); if (declaration != null && declaration.getVariables().firstOrNullObject().getInitializer().isNull()) { final AssignmentExpression assignment = _initializers.get(fieldName); final Expression value = assignment.getRight(); value.remove(); declaration.getVariables().firstOrNullObject().setInitializer(value); final AstNode parent = assignment.getParent(); if (parent instanceof ExpressionStatement) { parent.remove(); } else if (parent.getRole() == Roles.VARIABLE) { final Expression left = assignment.getLeft(); left.remove(); assignment.replaceWith(left); } else { final Expression left = assignment.getLeft(); left.remove(); parent.replaceWith(left); } } } }
private void inlineInitializers() { for (final String fieldName : _initializers.keySet()) { final FieldDeclaration declaration = _fieldDeclarations.get(fieldName); if (declaration != null && declaration.getVariables().firstOrNullObject().getInitializer().isNull()) { final AssignmentExpression assignment = _initializers.get(fieldName); final Expression value = assignment.getRight(); value.remove(); declaration.getVariables().firstOrNullObject().setInitializer(value); final AstNode parent = assignment.getParent(); if (parent instanceof ExpressionStatement) { parent.remove(); } else if (parent.getRole() == Roles.VARIABLE) { final Expression left = assignment.getLeft(); left.remove(); assignment.replaceWith(left); } else { final Expression left = assignment.getLeft(); left.remove(); parent.replaceWith(left); } } } }