public static boolean isInAssignmentOrInvocationContext(PsiExpression expr) {
    final PsiElement context = PsiUtil.skipParenthesizedExprUp(expr.getParent());
    return context instanceof PsiExpressionList ||
           context instanceof PsiArrayInitializerExpression ||
           context instanceof PsiConditionalExpression && (expr instanceof PsiCallExpression || isPolyExpression((PsiExpression)context)) ||
           isSwitchExpressionAssignmentOrInvocationContext(expr) ||
           isAssignmentContext(expr, context);
  }
public static boolean isInAssignmentOrInvocationContext(PsiExpression expr)