Commit ca46d72d authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Detect doc-comment before Ext.emptyFn as method.

parent 5bcd246b
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -106,6 +106,16 @@ module JsDuck
      }
    end

    # <ext-emptyfn> := "Ext" "." "emptyFn"
    def ext_emptyfn
      match(:ident, ".", "emptyFn")
      return {
        :type => :function,
        :name => "",
        :params => [],
      }
    end

    # <function-parameters> := "(" [ <ident> [ "," <ident> ]* ] ")"
    def function_parameters
      match("(")
@@ -157,12 +167,14 @@ module JsDuck
      return chain
    end

    # <expression> := <function> | <ext-extend> | <ext-base-css-prefix> | <literal>
    # <expression> := <function> | <ext-extend> | <ext-emptyfn> | <ext-base-css-prefix> | <literal>
    def expression
      if look(:function)
        function
      elsif ext_look(:ns, ".", "extend")
        ext_extend
      elsif ext_look(:ns, ".", "emptyFn")
        ext_emptyfn
      elsif ext_look(:ns, ".", "baseCSSPrefix", "+", :string)
        ext_base_css_prefix
      else
+7 −0
Original line number Diff line number Diff line
@@ -137,6 +137,13 @@ describe JsDuck::Aggregator do
    it_should_behave_like "method documentation"
  end

  describe "Ext.emptyFn in object-literal" do
    before do
      @doc = parse("/** Some function */ foo: Ext.emptyFn")[0]
    end
    it_should_behave_like "method documentation"
  end

  describe "anonymous function" do
    before do
      @doc = parse("/** Some function */ function() {}")[0]