code: private static Node getReplacementReturnStatement(
        Node node, String resultName) {
      Node resultNode = null;
  
      Node retVal = null;
      if (node.hasChildren()) {
        // Clone the child as the child hasn't been removed
        // from the node yet.
        retVal = node.getFirstChild().cloneTree();
      }
  
      if (resultName == null) {
        if (retVal != null) {
          resultNode = NodeUtil.newExpr(retVal); // maybe null.
        }
      } else {
        if (retVal == null) {
          // A result is needed create a dummy value.
          Node srcLocation = node;
          retVal = NodeUtil.newUndefinedNode(srcLocation);
        }
        // Create a "resultName = retVal;" statement.
        resultNode = createAssignStatementNode(resultName, retVal);
      }
  
      return resultNode;
    }
docs: Replace the 'return' statement with its child expression.
  If the result is needed (resultName != null):
  "return foo()" becomes "resultName = foo()"
  "return" becomes "resultName = void 0".
  Otherwise:
  "return foo()" becomes "foo()"
  "return", null is returned.