int (GrExpression expr) { if (expr instanceof GrUnaryExpression) return ((GrUnaryExpression)expr).isPostfix() ? POSTFIX_PRECEDENCE : PREFIX_PRECEDENCE; if (expr instanceof GrTypeCastExpression) return TYPE_CAST_PRECEDENCE; if (expr instanceof GrRangeExpression) return RANGE_PRECEDENCE; if (expr instanceof GrConditionalExpression) return CONDITIONAL_PRECEDENCE; if (expr instanceof GrSafeCastExpression) return SAFE_CAST_PRECEDENCE; if (expr instanceof GrAssignmentExpression) return ASSIGNMENT_PRECEDENCE; if (expr instanceof GrApplicationStatement) return APPLICATION_STMT_PRECEDENCE; if (expr instanceof GrInstanceOfExpression) return INSTANCEOF_PRECEDENCE; if (expr instanceof GrNewExpression) return NEW_EXPR_PRECEDENCE; if (expr instanceof GrParenthesizedExpression) return PARENTHESIZED_PRECEDENCE; if (expr instanceof GrReferenceExpression referenceExpression) { return referenceExpression.getQualifierExpression() == null ? LITERAL_PRECEDENCE : METHOD_CALL_PRECEDENCE; } if (expr instanceof GrBinaryExpression) { final IElementType opToken = ((GrBinaryExpression)expr).getOperationTokenType(); return precedenceForBinaryOperator(opToken); } return 0; }