Commit 3b89ab68 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Use current tag type for @alias type.

parent 671ac612
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ module JsDuck
    # Copy over doc/params/return from original methods to aliases.
    def resolve(al)
      al_def = al[:alias]
      orig = @relations[al_def[:cls]].get_member(al_def[:member], al_def[:type])
      orig = @relations[al_def[:cls]].get_member(al_def[:member], al_def[:type] || al[:tagname])
      al[:doc] = al[:doc] + "\n\n" + orig[:doc]
      al[:params] = orig[:params] if orig[:params]
      al[:return] = orig[:return] if orig[:return]
+31 −0
Original line number Diff line number Diff line
@@ -182,5 +182,36 @@ describe JsDuck::Aggregator do
    it_behaves_like "@alias"
  end

  describe "@alias without type info uses the type of itself" do
    before do
      @docs = parse(<<-EOF)
        /** @class Foo */
          /**
           * @cfg bar
           * Original comment.
           */
          /**
           * @method bar
           * Method comment.
           */
          /**
           * @property bar
           * Prop comment.
           */

        /** @class Core */
          /**
           * @cfg foobar
           * Alias comment.
           * @alias Foo#bar
           */
      EOF
      @orig = @docs["Foo"][:members][:cfg][0]
      @alias = @docs["Core"][:members][:cfg][0]
    end

    it_behaves_like "@alias"
  end

end