private static PsiFunctionalExpression extractFunctionalExpression(PsiExpression expr) {
    PsiElement parent = expr.getParent();
    if (expr instanceof PsiFunctionalExpression && parent instanceof PsiExpressionStatement && !(parent.getParent() instanceof PsiSwitchLabeledRuleStatement)) {
      return (PsiFunctionalExpression)expr;
    }
    parent = PsiTreeUtil.skipParentsOfType(expr, PsiParenthesizedExpression.class);
    if (parent instanceof PsiAssignmentExpression &&
        parent.getParent() instanceof PsiExpressionStatement &&
        PsiTreeUtil.isAncestor(((PsiAssignmentExpression)parent).getLExpression(), expr, false)) {
      return ObjectUtils.tryCast(((PsiAssignmentExpression)parent).getRExpression(), PsiFunctionalExpression.class);
    }
    return null;
  }
private static PsiFunctionalExpression extractFunctionalExpression(PsiExpression expr)