@Nullable
  static PsiReferenceExpression replaceCall(@NotNull PsiElementFactory factory,
                                            @NotNull PsiMethodCallExpression methodCall,
                                            @Nullable PsiElement firstAdded,
                                            @Nullable PsiLocalVariable resultVar) {
    if (resultVar != null) {
      PsiExpression expr = factory.createExpressionFromText(resultVar.getName(), null);
      return (PsiReferenceExpression)new CommentTracker().replaceAndRestoreComments(methodCall, expr);
    }
    // If return var is not specified, we trust that InlineTransformer fully processed the original anchor statement,
    // and we can delete it.
    CommentTracker tracker = new CommentTracker();
    PsiElement anchor = CommonJavaRefactoringUtil.getParentStatement(methodCall, true);
    assert anchor != null;
    if (firstAdded != null) {
      tracker.delete(anchor);
      tracker.insertCommentsBefore(firstAdded);
    } else {
      tracker.deleteAndRestoreComments(anchor);
    }
    return null;
  }
@Nullable
  static PsiReferenceExpression replaceCall(@NotNull PsiElementFactory factory,
                                            @NotNull PsiMethodCallExpression methodCall,
                                            @Nullable PsiElement firstAdded,
                                            @Nullable PsiLocalVariable resultVar)