Commit 4ae45cb6 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Allow for @extends {ClassName} syntax.

A minor enhancement to improve compatibility with Closure Compiler.
parent 01456f32
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -12,10 +12,19 @@ module JsDuck::Tag
    end

    # @extends classname
    # or
    # @extends {classname}
    def parse_doc(p)
      if p.hw.match(/\{/)
        cls = p.ident_chain
        p.match(/\}/)
      else
        cls = p.ident_chain
      end

      {
        :tagname => :extends,
        :extends => p.hw.ident_chain,
        :extends => cls,
      }
    end

+15 −0
Original line number Diff line number Diff line
@@ -538,6 +538,21 @@ describe JsDuck::Aggregator do
  end


  describe "@extend followed by class name in {curly brackets}" do
    before do
      @doc = parse(<<-EOS)["Foo"]
        /**
         * @class Foo
         * @extends {Bar.Baz}
         */
      EOS
    end
    it "detectes the name of the extended class" do
      @doc[:extends].should == "Bar.Baz"
    end
  end


  shared_examples_for "extending Object" do
    it "has extends == nil" do
      @doc[:extends].should == nil