code: private void rewriteReturns(Node fnNode) {
      checkState(fnNode.isFunction());
      final Node body = fnNode.getLastChild();
      NodeUtil.visitPostOrder(
        body,
        new NodeUtil.Visitor() {
          @Override
          public void visit(Node n) {
            if (n.isReturn() && n.hasOneChild()) {
              Node result = n.getFirstChild();
              boolean keepValue = !isRemovableValue(result);
              result.detach();
              if (keepValue) {
                n.getParent().addChildBefore(IR.exprResult(result).srcref(result), n);
              } else {
                NodeUtil.markFunctionsDeleted(result, compiler);
              }
              compiler.reportChangeToEnclosingScope(body);
            }
          }
        },
        new NodeUtil.MatchShallowStatement());
    }
docs: For the supplied function node, rewrite all the return expressions so that:
  return foo();
  becomes:
  foo(); return;
  Useless return will be removed later by the peephole optimization passes.