Commit 54eb7aec authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix crash when parentless sub-cfg in class doc-comment.

Nothing really good to do in this situation, but at least avoid
crashing.

Refs #475
parent b6084aa6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ module JsDuck

        if tagname == :cfg || tagname == :constructor
          group_name = tagname
          if tagname == :cfg && tag[:name] !~ /\./
          if tagname == :cfg && (tag[:name] !~ /\./ || groups[:cfg].length == 0)
            groups[:cfg] << []
          end
        end
+16 −0
Original line number Diff line number Diff line
@@ -323,6 +323,22 @@ describe JsDuck::Aggregator do
    end
  end

  describe "class with parentless sub-cfg" do
    before do
      @doc = parse(<<-EOS)["MyClass"]
        /**
         * @class MyClass
         * Comment here.
         * @cfg {String} foo.one
         */
      EOS
    end

    it "detects the one bogus config" do
      @doc[:members].length.should == 1
    end
  end

  describe "implicit class with more than one cfg" do
    before do
      @doc = parse(<<-EOS)["MyClass"]