Commit 24d8b407 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Introduce :autodetected flag.

Use it instead of @private=:inherit and @inheritdoc={:no_warings=>true}
parent 373206ef
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -244,8 +244,8 @@ module JsDuck
        if docset
          docset[:code] = cfg
        else
          cfg[:inheritdoc] = {:no_warnings => true}
          cfg[:private] = :inherit
          cfg[:inheritdoc] = {}
          cfg[:autodetected] = true
          configs << cfg
        end
      end
+4 −6
Original line number Diff line number Diff line
@@ -39,10 +39,8 @@ module JsDuck
    # For auto-detected members/classes (which have @private == :inherit)
    # Use the visibility from parent class (defaulting to private when no parent).
    def resolve_visibility(m, parent)
      if m[:private] == :inherit
        if parent
          m[:meta][:private] = m[:private] = parent[:private]
        else
      if m[:autodetected]
        if !parent || parent[:private]
          m[:meta][:private] = m[:private] = true
        end
      end
@@ -74,7 +72,7 @@ module JsDuck

        # Warn when no parent or mixins at all
        if !parent_cls && mixins.length == 0
          warn("parent class not found", m) unless inherit[:no_warnings]
          warn("parent class not found", m) unless m[:autodetected]
          return nil
        end

@@ -93,7 +91,7 @@ module JsDuck

        # Only when both parent and mixins fail, throw warning
        if !parent
          warn("parent member not found", m) unless inherit[:no_warnings]
          warn("parent member not found", m) unless m[:autodetected]
          return nil
        end
      end
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ module JsDuck
      # Copy private to meta
      h[:meta][:private] = h[:private] if h[:private]

      # Remember auto-detection info
      h[:autodetected] = code[:autodetected] if code[:autodetected]

      h
    end

+3 −9
Original line number Diff line number Diff line
@@ -33,17 +33,11 @@ describe JsDuck::Aggregator do
    end

    it "sets :inheritdoc flag on config" do
      cfg[0][:inheritdoc].should == {:no_warnings => true}
      cfg[0][:inheritdoc].should == {}
    end

    # The inheriting of :private will be solved by InheritDoc class.

    it "sets :private flag on config is :inherit" do
      cfg[0][:private].should == :inherit
    end

    it "sets :private flag on config is :inherit (meta)" do
      cfg[0][:meta][:private].should == :inherit
    it "sets :autodetected flag on config" do
      cfg[0][:autodetected].should == true
    end
  end