Commit 38c79ec1 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Corrected "Function" type detection.

parent bca4add1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -178,10 +178,10 @@ module JsDuck
      elsif doc_map[:type]
        doc_map[:type].first[:type]
      elsif code[:type] == :function
        :function
        "Function"
      elsif code[:type] == :assignment && code[:right]
        if code[:right][:type] == :function
          :function
          "Function"
        elsif code[:right][:type] == :literal
          code[:right][:class]
        end
+4 −0
Original line number Diff line number Diff line
@@ -462,6 +462,10 @@ this.locked = false;
    assert_equal("Boolean", docs[0][:type])
    docs = JsDuck.parse(comment + "foo: false,")
    assert_equal("Boolean", docs[0][:type])
    docs = JsDuck.parse(comment + "foo: function(){},")
    assert_equal("Function", docs[0][:type])
    docs = JsDuck.parse(comment + "function foo(){},")
    assert_equal("Function", docs[0][:type])
  end

  def test_visibility_modifiers