Commit 47440bda authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Support for @static.

Applies only to properties and methods.

This was one of the most used @tags in ExtJS not already supported by
JsDuck.
parent 68cd2e10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,9 +27,9 @@ List of @tags to support
* @event - OK
* @param - OK
* @return - OK
* @static - OK

* @member
* @static
* @link

* @ignore @hide @private - in JsDuck implementation @ignore and @hide
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ module JsDuck
          boolean_at_tag(/@ignore/, :private)
        elsif look(/@hide\b/) then
          boolean_at_tag(/@hide/, :private)
        elsif look(/@static\b/) then
          boolean_at_tag(/@static/, :static)
        elsif look(/@/) then
          @current_tag[:doc] += @input.scan(/@/)
        elsif look(/[^@]/) then
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ module JsDuck
        :params => detect_params(docs, code),
        :return => doc_map[:return] ? doc_map[:return].first : nil,
        :private => !!doc_map[:private],
        :static => !!doc_map[:static],
      }
    end

@@ -147,6 +148,7 @@ module JsDuck
        :type => detect_type(:prop, doc_map, code),
        :doc => detect_doc(docs),
        :private => !!doc_map[:private],
        :static => !!doc_map[:static],
      }
    end

+16 −0
Original line number Diff line number Diff line
@@ -401,6 +401,22 @@ foo: true,
    end
  end

  def test_static_method
    docs = JsDuck.parse("/**
 * @method
 * @static
 */");
    assert_equal(true, docs[0][:static])
  end

  def test_static_property
    docs = JsDuck.parse("/**
 * @property
 * @static
 */");
    assert_equal(true, docs[0][:static])
  end

  def test_member_docs_following_class
    docs = JsDuck.parse("
/**