Commit 36bfd15d authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Use @alias as alias for @inheritdoc.

parent 97071f5a
Loading
Loading
Loading
Loading
+3 −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(/@inherit[dD]oc\b/)
        elsif look(/@(inherit[dD]oc|alias)\b/)
          at_inheritdoc
        elsif look(/@deprecated\b/)
          at_deprecated
@@ -328,7 +328,8 @@ module JsDuck

    # matches @inheritdoc class.name#type-member
    def at_inheritdoc
      match(/@inherit[dD]oc/)
      match(/@inherit[dD]oc|@alias/)

      add_tag(:inheritdoc)
      skip_horiz_white
      if look(@ident_chain_pattern)
+17 −3
Original line number Diff line number Diff line
@@ -62,8 +62,9 @@ describe JsDuck::Aggregator do
    end
  end

  describe "@inheritDoc" do
    before do
  # Helper to parse simple source codes to test if @inheritdoc tag
  # aliases work
  def parse_simple_source(at_tag)
      @docs = parse(<<-EOF)
        /** @class Foo */
          /**
@@ -75,13 +76,26 @@ describe JsDuck::Aggregator do
          /**
           * @method foobar
           * New comment.
           * @inheritDoc Foo#bar
           * #{at_tag} Foo#bar
           */
      EOF
      @orig = @docs["Foo"][:members][:method][0]
      @inheritdoc = @docs["Core"][:members][:method][0]
  end

  describe "@inheritDoc" do
    before do
      parse_simple_source("@inheritDoc")
    end

    it_behaves_like "@inheritdoc"
  end

  describe "@alias" do
    before do
      parse_simple_source("@alias")
    end

    it_behaves_like "@inheritdoc"
  end