Commit 7a99dd1a authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Merge branch 'master' into doc-tags

parents 25cb1991 e46e0724
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -158,7 +158,9 @@ module JsDuck
    # Creates classes for orphans that have :owner property defined,
    # and then inserts orphans to these classes.
    def classify_orphans
      @orphans.each do |orph|
      # Clone the orphans array first to avoid problems with
      # #inster_orphan method deleting items from @orphans array.
      @orphans.clone.each do |orph|
        if orph[:owner]
          class_name = orph[:owner]
          if !@classes[class_name]
+5 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ module JsDuck

          # add all local members, but skip constructors
          cls[:members].each do |m|
            list << member_node(m, cls) unless m[:name] == ClassName.short(cls[:name])
            list << member_node(m, cls) unless m[:hide] || constructor?(m)
          end
        end

@@ -44,6 +44,10 @@ module JsDuck

      private

      def constructor?(m)
        m[:tagname] == :method && m[:name] == "constructor"
      end

      def alias_node(key, name, cls)
        return {
          :name => name,
+16 −0
Original line number Diff line number Diff line
@@ -49,4 +49,20 @@ describe JsDuck::Aggregator do
    end
  end

  it "creates classes for all orphans with @member defined" do
    classes = parse(<<-EOS)
      /**
       * @cfg foo
       * @member FooCls
       */
      /**
       * @cfg bar
       * @member BarCls
       */
    EOS

    classes["FooCls"][:members].length.should == 1
    classes["BarCls"][:members].length.should == 1
  end

end