Commit 97071f5a authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Also support @inheritDoc.

parent 6f514707
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ module JsDuck
          at_ftype
        elsif look(/@member\b/)
          at_member
        elsif look(/@inheritdoc\b/)
        elsif look(/@inherit[dD]oc\b/)
          at_inheritdoc
        elsif look(/@deprecated\b/)
          at_deprecated
@@ -328,7 +328,7 @@ module JsDuck

    # matches @inheritdoc class.name#type-member
    def at_inheritdoc
      match(/@inheritdoc/)
      match(/@inherit[dD]oc/)
      add_tag(:inheritdoc)
      skip_horiz_white
      if look(@ident_chain_pattern)
+23 −0
Original line number Diff line number Diff line
@@ -62,6 +62,29 @@ describe JsDuck::Aggregator do
    end
  end

  describe "@inheritDoc" do
    before do
      @docs = parse(<<-EOF)
        /** @class Foo */
          /**
           * @method bar
           * Original comment.
           */

        /** @class Core */
          /**
           * @method foobar
           * New comment.
           * @inheritDoc Foo#bar
           */
      EOF
      @orig = @docs["Foo"][:members][:method][0]
      @inheritdoc = @docs["Core"][:members][:method][0]
    end

    it_behaves_like "@inheritdoc"
  end

  describe "@inheritdoc of event" do
    before do
      @docs = parse(<<-EOF)