Commit 21a2f441 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Handle null value in code as type=Object.

Previusly null resulted in type=nil which caused problems when
@cfg happened to be @accessor that generated methods which then
ended up having nil return type and nil param type.
parent 7e918c80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ module JsDuck
        elsif code[:type] == :assignment && code[:right]
          if code[:right][:type] == :function
            return "Function"
          elsif code[:right][:type] == :literal
          elsif code[:right][:type] == :literal && code[:right][:class] != nil
            return code[:right][:class]
          end
        end
+15 −0
Original line number Diff line number Diff line
@@ -115,6 +115,21 @@ describe JsDuck::Aggregator do
    it_should_behave_like "cfg or property default type"
  end

  describe "null @cfg" do
    before do
      @doc = parse(<<-EOS)[0]
      ({/**
         * @cfg
         * Some documentation.
         */
        foo: null })
      EOS
    end
    it_should_behave_like "cfg"
    it_should_behave_like "cfg or property"
    it_should_behave_like "cfg or property default type"
  end

  describe "typeless @property" do
    before do
      @doc = parse(<<-EOS)[0]