Loading lib/jsduck/doc/ast.rb +0 −12 Original line number Diff line number Diff line Loading @@ -50,7 +50,6 @@ module JsDuck return add_shared({ :tagname => :method, :doc => detect_doc(:method, doc_map), :return => detect_return(doc_map), }, doc_map) end Loading Loading @@ -152,17 +151,6 @@ module JsDuck items end def detect_return(doc_map) has_return_tag = !!extract(doc_map, :return) ret = extract(doc_map, :return) || {} return { :type => ret[:type] || (has_return_tag ? "Object" : "undefined"), :name => ret[:name] || "return", :doc => ret[:doc] || "", :properties => doc_map[:return] ? detect_subproperties(:return, doc_map[:return]) : [] } end # Returns documentation for class or member. def detect_doc(tagname, doc_map) doc = extract(doc_map, :doc, :doc) || "" Loading lib/jsduck/process/return_values.rb +6 −3 Original line number Diff line number Diff line Loading @@ -50,17 +50,20 @@ module JsDuck end def add_return_this(m) if m[:return][:type] == "undefined" && m[:return][:doc] == "" if m[:return] == nil m[:return] = {:type => @cls[:name], :doc => "this"} end end def add_return_new(m) if m[:return][:type] == "undefined" || m[:return][:type] == "Object" if m[:return] == nil || m[:return][:type] == "Object" # Create a whole new :return hash. # If we were to just change the :type field it would modify # the type of all the inherited constructor docs. m[:return] = {:type => @cls[:name], :doc => m[:return][:doc]} m[:return] = { :type => @cls[:name], :doc => m[:return] ? m[:return][:doc] : "", } end end end Loading lib/jsduck/renderer.rb +0 −1 Original line number Diff line number Diff line Loading @@ -326,7 +326,6 @@ module JsDuck end def render_return(ret) return if ret[:type] == "undefined" return [ "<h3 class='pa'>Returns</h3>", "<ul>", Loading lib/jsduck/signature_renderer.rb +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ module JsDuck end def method_with_return? @m[:tagname] == :method && @m[:return][:type] != "undefined" @m[:tagname] == :method && @m[:return] != nil end def render_tag_signature Loading lib/jsduck/tag/return.rb +18 −0 Original line number Diff line number Diff line require "jsduck/tag/tag" require "jsduck/doc/subproperties" module JsDuck::Tag class Return < Tag def initialize @pattern = ["return", "returns"] @key = :return end # @return {Type} return.name ... Loading @@ -21,5 +23,21 @@ module JsDuck::Tag "return" end end def process_doc(h, tags, pos) ret = tags[0] h[:return] = { :type => ret[:type] || "Object", :name => ret[:name] || "return", :doc => ret[:doc] || "", :properties => nest_properties(tags, pos)[0][:properties] } end def nest_properties(tags, pos) items, warnings = JsDuck::Doc::Subproperties.nest(tags) warnings.each {|msg| JsDuck::Logger.warn(:subproperty, msg, pos[:filename], pos[:linenr]) } items end end end Loading
lib/jsduck/doc/ast.rb +0 −12 Original line number Diff line number Diff line Loading @@ -50,7 +50,6 @@ module JsDuck return add_shared({ :tagname => :method, :doc => detect_doc(:method, doc_map), :return => detect_return(doc_map), }, doc_map) end Loading Loading @@ -152,17 +151,6 @@ module JsDuck items end def detect_return(doc_map) has_return_tag = !!extract(doc_map, :return) ret = extract(doc_map, :return) || {} return { :type => ret[:type] || (has_return_tag ? "Object" : "undefined"), :name => ret[:name] || "return", :doc => ret[:doc] || "", :properties => doc_map[:return] ? detect_subproperties(:return, doc_map[:return]) : [] } end # Returns documentation for class or member. def detect_doc(tagname, doc_map) doc = extract(doc_map, :doc, :doc) || "" Loading
lib/jsduck/process/return_values.rb +6 −3 Original line number Diff line number Diff line Loading @@ -50,17 +50,20 @@ module JsDuck end def add_return_this(m) if m[:return][:type] == "undefined" && m[:return][:doc] == "" if m[:return] == nil m[:return] = {:type => @cls[:name], :doc => "this"} end end def add_return_new(m) if m[:return][:type] == "undefined" || m[:return][:type] == "Object" if m[:return] == nil || m[:return][:type] == "Object" # Create a whole new :return hash. # If we were to just change the :type field it would modify # the type of all the inherited constructor docs. m[:return] = {:type => @cls[:name], :doc => m[:return][:doc]} m[:return] = { :type => @cls[:name], :doc => m[:return] ? m[:return][:doc] : "", } end end end Loading
lib/jsduck/renderer.rb +0 −1 Original line number Diff line number Diff line Loading @@ -326,7 +326,6 @@ module JsDuck end def render_return(ret) return if ret[:type] == "undefined" return [ "<h3 class='pa'>Returns</h3>", "<ul>", Loading
lib/jsduck/signature_renderer.rb +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ module JsDuck end def method_with_return? @m[:tagname] == :method && @m[:return][:type] != "undefined" @m[:tagname] == :method && @m[:return] != nil end def render_tag_signature Loading
lib/jsduck/tag/return.rb +18 −0 Original line number Diff line number Diff line require "jsduck/tag/tag" require "jsduck/doc/subproperties" module JsDuck::Tag class Return < Tag def initialize @pattern = ["return", "returns"] @key = :return end # @return {Type} return.name ... Loading @@ -21,5 +23,21 @@ module JsDuck::Tag "return" end end def process_doc(h, tags, pos) ret = tags[0] h[:return] = { :type => ret[:type] || "Object", :name => ret[:name] || "return", :doc => ret[:doc] || "", :properties => nest_properties(tags, pos)[0][:properties] } end def nest_properties(tags, pos) items, warnings = JsDuck::Doc::Subproperties.nest(tags) warnings.each {|msg| JsDuck::Logger.warn(:subproperty, msg, pos[:filename], pos[:linenr]) } items end end end