Commit 84ad05fa authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Exclude :inheritdoc and :localdoc from accessors.

The docs for accessors get auto-generated and we need nothing extra.
Having the :inheritdoc in there also causes errors when looking up
the parent.  For example the following:

    /**
     * @cfg {Number} width
     * @inheritdoc SomeClass#width
     * @accessor
     */

When the accessors would get the @inheritdoc, this would look like
we had the following methods:

    /**
     * @method getWidth
     * @inheritdoc SomeClass#width
     */

    /**
     * @method setWidth
     * @inheritdoc SomeClass#width
     */

But the inheritance system would attempt to inherit the docs from
"width" method, but there is no such thing because we were actually
inheriting from "width" config.

Therefore we're better off without the whole @inheritdoc in accessors.
parent 34c3163d
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -127,9 +127,15 @@ module JsDuck
      end

      # Copy over from @cfg all the fields that aren't already present.
      # Except :type and :default which don't make sense for methods and events.
      def add_shared(hash, cfg)
        ignored_fields = [:type, :default, :accessor, :evented]
        ignored_fields = [
          # These don't make sense for methods and events.
          :type, :default,
          # It's the config that's tagged with these, don't propagate them to methods/events.
          :accessor, :evented,
          # The :doc field get auto-created and we don't want any other docs.
          :inheritdoc, :localdoc,
        ]

        cfg.each_pair do |key, value|
          hash[key] = value unless ignored_fields.include?(key) || hash[key]