private static boolean isAccessedForWriting (PsiExpression expr) {
    while (expr.getParent() instanceof PsiArrayAccessExpression) {
      expr = (PsiExpression)expr.getParent();
    }
    return PsiUtil.isAccessedForWriting(expr);
  }
private static boolean isAccessedForWriting (PsiExpression expr)