Commit f2b692a6 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Treating @extend as alias for @extends.

Hard to get it correct when there are:

- Ext.extend(...
- Ext.define("MyClass", {extend: "Parent", ...

But in doc-comment you had to previously write "@extends".
Now it's similar to @returns, which can also be @return.
parent 860ba975
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ module JsDuck
      while !@input.eos? do
        if look(/@class\b/)
          at_class
        elsif look(/@extends\b/)
        elsif look(/@extends?\b/)
          at_extends
        elsif look(/@singleton\b/)
          boolean_at_tag(/@singleton/, :singleton)
@@ -126,7 +126,7 @@ module JsDuck

    # matches @extends name ...
    def at_extends
      match(/@extends/)
      match(/@extends?/)
      add_tag(:extends)
      maybe_ident_chain(:extends)
      skip_white
+18 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ describe JsDuck::Aggregator do

    it_should_behave_like "class"
    it "detects extends" do
      @doc[:extends] == "Your.Class"
      @doc[:extends].should == "Your.Class"
    end
    it "takes documentation from doc-comment" do
      @doc[:doc].should == "Some documentation."
@@ -46,6 +46,23 @@ describe JsDuck::Aggregator do
    end
  end

  describe "class with @extend" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
         * @class MyClass
         * @extend Your.Class
         * Some documentation.
         */
      EOS
    end

    it_should_behave_like "class"
    it "treated as alias for @extends" do
      @doc[:extends].should == "Your.Class"
    end
  end

  describe "function after doc-comment" do
    before do
      @doc = parse("/** */ function MyClass() {}")[0]