Loading lib/jsduck/doc_ast.rb +4 −1 Original line number Diff line number Diff line require 'jsduck/tag_registry' require 'jsduck/subproperties' require 'jsduck/logger' module JsDuck Loading Loading @@ -158,7 +159,9 @@ module JsDuck end def nest_properties(raw_items) Subproperties.nest(raw_items, @filename, @linenr) items, warnings = Subproperties.nest(raw_items) warnings.each {|msg| Logger.warn(:subproperty, msg, @filename, @linenr) } items end def detect_return(doc_map) Loading lib/jsduck/subproperties.rb +9 −5 Original line number Diff line number Diff line require 'jsduck/logger' require 'jsduck/util/singleton' module JsDuck Loading @@ -22,10 +21,13 @@ module JsDuck # {:name => "baz"}]}, # {:name => "zap"}, # def nest(raw_items, filename, linenr) # NOTE: It returns two values: the resulting nested items array # and warnings array of :subproperty warnings that should get # printed out. def nest(raw_items) # First item can't be namespaced, if it is ignore the rest. if raw_items[0] && raw_items[0][:name] =~ /\./ return [raw_items[0]] return [raw_items[0]], [] end # build name-index of all items Loading @@ -36,6 +38,7 @@ module JsDuck # Otherwise look up the parent of item and add it as the # property of that parent. items = [] warnings = [] raw_items.each do |it| if it[:name] =~ /^(.+)\.([^.]+)$/ it[:name] = $2 Loading @@ -44,13 +47,14 @@ module JsDuck parent[:properties] = [] unless parent[:properties] parent[:properties] << it else Logger.warn(:subproperty, "Ignoring subproperty #{$1}.#{$2}, no parent found with name '#{$1}'.", filename, linenr) warnings << "Ignoring subproperty #{$1}.#{$2}, no parent found with name '#{$1}'." end else items << it end end items return items, warnings end end Loading Loading
lib/jsduck/doc_ast.rb +4 −1 Original line number Diff line number Diff line require 'jsduck/tag_registry' require 'jsduck/subproperties' require 'jsduck/logger' module JsDuck Loading Loading @@ -158,7 +159,9 @@ module JsDuck end def nest_properties(raw_items) Subproperties.nest(raw_items, @filename, @linenr) items, warnings = Subproperties.nest(raw_items) warnings.each {|msg| Logger.warn(:subproperty, msg, @filename, @linenr) } items end def detect_return(doc_map) Loading
lib/jsduck/subproperties.rb +9 −5 Original line number Diff line number Diff line require 'jsduck/logger' require 'jsduck/util/singleton' module JsDuck Loading @@ -22,10 +21,13 @@ module JsDuck # {:name => "baz"}]}, # {:name => "zap"}, # def nest(raw_items, filename, linenr) # NOTE: It returns two values: the resulting nested items array # and warnings array of :subproperty warnings that should get # printed out. def nest(raw_items) # First item can't be namespaced, if it is ignore the rest. if raw_items[0] && raw_items[0][:name] =~ /\./ return [raw_items[0]] return [raw_items[0]], [] end # build name-index of all items Loading @@ -36,6 +38,7 @@ module JsDuck # Otherwise look up the parent of item and add it as the # property of that parent. items = [] warnings = [] raw_items.each do |it| if it[:name] =~ /^(.+)\.([^.]+)$/ it[:name] = $2 Loading @@ -44,13 +47,14 @@ module JsDuck parent[:properties] = [] unless parent[:properties] parent[:properties] << it else Logger.warn(:subproperty, "Ignoring subproperty #{$1}.#{$2}, no parent found with name '#{$1}'.", filename, linenr) warnings << "Ignoring subproperty #{$1}.#{$2}, no parent found with name '#{$1}'." end else items << it end end items return items, warnings end end Loading