Commit 50b257cc authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Make default return type of methods undefined.

Instead of the previous 'void'.

Also hide the return type in method signature if method returns nothing.
parent 463fd706
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ module JsDuck
        :owner => detect_owner(doc_map),
        :doc => detect_doc(docs),
        :params => detect_params(docs, code),
        :return => detect_return(doc_map, name == "constructor" ? "Object" : "void"),
        :return => detect_return(doc_map, name == "constructor" ? "Object" : "undefined"),
      }, doc_map)
    end

@@ -337,7 +337,7 @@ module JsDuck
      docs.find_all {|tag| tag[:tagname] == :param}
    end

    def detect_return(doc_map, default_type="void")
    def detect_return(doc_map, default_type="undefined")
      ret = doc_map[:return] ? doc_map[:return].first : {}
      return {
        :type => ret[:type] || default_type,
+2 −2
Original line number Diff line number Diff line
@@ -62,8 +62,8 @@ describe JsDuck::Aggregator do
  end

  shared_examples_for "no return" do
    it "default return type is void" do
      @doc[:return][:type].should == "void"
    it "default return type is undefined" do
      @doc[:return][:type].should == "undefined"
    end
  end

+1 −1
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ Ext.define('Docs.view.cls.Overview', {
        else {
            var ps = Ext.Array.map(member.params, this.renderShortParam, this).join(", ");
            cfg.params = '( <span class="pre">' + ps + "</span> )";
            if (member.tagname === "method") {
            if (member.tagname === "method" && member["return"].type !== "undefined") {
                cfg.params += " : " + member["return"].type;
            }
        }