| 24 | import java.util.List; |
| 25 | |
| 26 | public interface Expression extends Node, AnnotationValue { |
| 27 | /** |
| 28 | * Returns the actual amount of parentheses physically around this expression. |
| 29 | * |
| 30 | * @see #astParensPositions() |
| 31 | * @see #getIntendedParens() |
| 32 | */ |
| 33 | int getParens(); |
| 34 | |
| 35 | /** |
| 36 | * Returns the same value as {@link #getParens()}, <i>unless</i> that method returns {@code 0}, |
| 37 | * and {@link #needsParentheses()} is {@code true}, then this method returns {@code 1}. |
| 38 | */ |
| 39 | int getIntendedParens(); |
| 40 | |
| 41 | /** |
| 42 | * Returns the start/end position of each paren pair around this node. The only canonical aspect |
| 43 | * of this list is the size of it. The positions are set to appropriate files after parsing, from |
| 44 | * the innermost parens at index 0 to the outermost at the final index. |
| 45 | * |
| 46 | * @see #getParens() |
| 47 | */ |
| 48 | List<Position> astParensPositions(); |
| 49 | |
| 50 | /** |
| 51 | * Returns {@code true} if the expression would need parentheses because without them the interpretation |
| 52 | * of this node would be different, due to operator precedence rules. |
| 53 | * |
| 54 | * @see #getIntendedParens() |
| 55 | */ |
| 56 | boolean needsParentheses(); |
| 57 | |
| 58 | /** |
| 59 | * Returns true if the given expression is a valid statement expression. |
| 60 | * Statement expressions can be executed as statements simply by appending a semicolon to them. |
| 61 | */ |
| 62 | boolean isStatementExpression(); |
| 63 | } |
no outgoing calls
no test coverage detected