Commit 16b541d9 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Allow ... at the middle of type definition.

parent 49ec2225
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -46,9 +46,6 @@ module JsDuck
        return false unless base_type
      end

      # The definition might end with an ellipsis
      @out << "..." if @input.scan(/\.\.\./)

      # Concatenate all output
      @out = @out.join

@@ -58,7 +55,7 @@ module JsDuck

    # The basic type
    #
    #     <ident> [ "." <ident> ]* [ "[]" ]
    #     <ident> [ "." <ident> ]* [ "[]" ] [ "..." ]
    #
    # dot-separated identifiers followed by optional "[]"
    def base_type
@@ -77,6 +74,8 @@ module JsDuck

      @out << "[]" if @input.scan(/\[\]/)

      @out << "..." if @input.scan(/\.\.\./)

      true
    end

+4 −4
Original line number Diff line number Diff line
@@ -60,6 +60,10 @@ describe JsDuck::TypeParser do
    it "complex alteration" do
      parse("Ext.form.Panel[]/Number/Ext.Element...").should == true
    end

    it "in the middle" do
      parse("Number.../String").should == true
    end
  end

  describe "doesn't match" do
@@ -90,10 +94,6 @@ describe JsDuck::TypeParser do
    it "/ at the end" do
      parse("Number/").should == false
    end

    it "... in the middle" do
      parse("Number.../String").should == false
    end
  end

end