@CopyMethod static String getDescription(UnaryExpression self) { try { return String.format("%s%s%s", self.astOperator().isPostfix() ? "X" : "", self.astOperator().getSymbol(), self.astOperator().isPostfix() ? "" : "X"); } catch (NullPointerException e) { return null; } }
@CopyMethod static String getDescription(UnaryExpression self) { try { return String.format("%s%s%s", self.astOperator().isPostfix() ? "X" : "", self.astOperator().getSymbol(), self.astOperator().isPostfix() ? "" : "X"); } catch (NullPointerException e) { return null; } }
@CopyMethod static String getDescription(UnaryExpression self) { try { return String.format("%s%s%s", self.astOperator().isPostfix() ? "X" : "", self.astOperator().getSymbol(), self.astOperator().isPostfix() ? "" : "X"); } catch (NullPointerException e) { return null; } }
@Override public boolean visitUnaryExpression(UnaryExpression node) { Expression operand = node.astOperand(); UnaryOperator operator = node.astOperator(); if (operator == UnaryOperator.UNARY_MINUS && operand instanceof IntegralLiteral) { JCLiteral result = (JCLiteral) toTree(operand); result.value = negative(result.value); return set(node, setPos(operand, result)); } int start = node.getPosition().getStart(); int end = node.getPosition().getEnd(); /* * The pos of "++x" is the entire thing, but the pos of "x++" is only the symbol. * I guess the javac guys think consistency is overrated :( */ if (hasSourceStructures()) { switch (operator) { case POSTFIX_DECREMENT: case POSTFIX_INCREMENT: start = posOfStructure(node, node.astOperator().getSymbol(), true); end = posOfStructure(node, node.astOperator().getSymbol(), false); } } return set(node, setPos(start, end, treeMaker.Unary(UNARY_OPERATORS.get(operator), toExpression(operand)))); }
@Override public boolean visitUnaryExpression(UnaryExpression node) { Expression operand = node.astOperand(); UnaryOperator operator = node.astOperator(); if (operator == UnaryOperator.UNARY_MINUS && operand instanceof IntegralLiteral) { JCLiteral result = (JCLiteral) toTree(operand); result.value = negative(result.value); return set(node, setPos(operand, result)); } int start = node.getPosition().getStart(); int end = node.getPosition().getEnd(); /* * The pos of "++x" is the entire thing, but the pos of "x++" is only the symbol. * I guess the javac guys think consistency is overrated :( */ if (hasSourceStructures()) { switch (operator) { case POSTFIX_DECREMENT: case POSTFIX_INCREMENT: start = posOfStructure(node, node.astOperator().getSymbol(), true); end = posOfStructure(node, node.astOperator().getSymbol(), false); } } return set(node, setPos(start, end, treeMaker.Unary(UNARY_OPERATORS.get(operator), toExpression(operand)))); }
@Override public boolean visitUnaryExpression(UnaryExpression node) { Expression operand = node.astOperand(); UnaryOperator operator = node.astOperator(); if (operator == UnaryOperator.UNARY_MINUS && operand instanceof IntegralLiteral) { JCLiteral result = (JCLiteral) toTree(operand); result.value = negative(result.value); return set(node, setPos(operand, result)); } int start = node.getPosition().getStart(); int end = node.getPosition().getEnd(); /* * The pos of "++x" is the entire thing, but the pos of "x++" is only the symbol. * I guess the javac guys think consistency is overrated :( */ if (hasSourceStructures()) { switch (operator) { case POSTFIX_DECREMENT: case POSTFIX_INCREMENT: start = posOfStructure(node, node.astOperator().getSymbol(), true); end = posOfStructure(node, node.astOperator().getSymbol(), false); } } return set(node, setPos(start, end, treeMaker.Unary(UNARY_OPERATORS.get(operator), toExpression(operand)))); }
@Override public boolean visitUnaryExpression(UnaryExpression node) { UnaryOperator op; parensOpen(node); try { op = node.astOperator(); if (op == null) throw new Exception(); } catch (Exception e) { formatter.buildInline(node); visit(node.astOperand()); formatter.closeInline(); parensClose(node); return true; } formatter.buildInline(node); formatter.property("operator", op.getSymbol()); formatter.property("postfix", op.isPostfix()); if (!op.isPostfix()) formatter.operator(op.getSymbol()); visit(node.astOperand()); if (op.isPostfix()) formatter.operator(op.getSymbol()); formatter.closeInline(); parensClose(node); return true; }
@Override public boolean visitUnaryExpression(UnaryExpression node) { UnaryOperator op; parensOpen(node); try { op = node.astOperator(); if (op == null) throw new Exception(); } catch (Exception e) { formatter.buildInline(node); visit(node.astOperand()); formatter.closeInline(); parensClose(node); return true; } formatter.buildInline(node); formatter.property("operator", op.getSymbol()); formatter.property("postfix", op.isPostfix()); if (!op.isPostfix()) formatter.operator(op.getSymbol()); visit(node.astOperand()); if (op.isPostfix()) formatter.operator(op.getSymbol()); formatter.closeInline(); parensClose(node); return true; }
@Override public boolean visitUnaryExpression(UnaryExpression node) { UnaryOperator op; parensOpen(node); try { op = node.astOperator(); if (op == null) throw new Exception(); } catch (Exception e) { formatter.buildInline(node); visit(node.astOperand()); formatter.closeInline(); parensClose(node); return true; } formatter.buildInline(node); formatter.property("operator", op.getSymbol()); formatter.property("postfix", op.isPostfix()); if (!op.isPostfix()) formatter.operator(op.getSymbol()); visit(node.astOperand()); if (op.isPostfix()) formatter.operator(op.getSymbol()); formatter.closeInline(); parensClose(node); return true; }