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

Turn @protected into builtin Tag class.

In so doing we need to also copy over the :protected property when
doing inheriting and expansion of accessors.
parent 7935a409
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ module JsDuck
        :owner => cfg[:owner],
        :files => cfg[:files],
        :private => cfg[:private],
        :protected => cfg[:protected],
        :autodetected => cfg[:autodetected],
        :meta => clone_meta(cfg),
      })
+15 −0
Original line number Diff line number Diff line
require "jsduck/meta_tag"
require "jsduck/builtins/boolean_tag"

module JsDuck::Tag
  # Implementation of @protected tag
  class Protected < JsDuck::MetaTag
module JsDuck::Builtins
  class Protected < BooleanTag
    def initialize
      @name = "protected"
      @key = :protected
      @signature = {:long => "protected", :short => "PRO"}
      @boolean = true
      super
    end
    # When the tag is found, its value will always be true.
    def process_doc(docs)
      true
    end
  end
end
+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ module JsDuck
        if !parent || parent[:private]
          m[:private] = true
        end

        m[:protected] = true if parent && parent[:protected]
      end
    end

+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ describe JsDuck::Aggregator do
    end

    it "gets protected attribute" do
      @doc[:meta][:protected].should == true
      @doc[:protected].should == true
    end
  end

+2 −2
Original line number Diff line number Diff line
@@ -679,7 +679,7 @@ describe JsDuck::Aggregator do
    end

    it "inherits @protected" do
      @property[:meta][:protected].should == true
      @property[:protected].should == true
    end

    it "inherits @deprecated" do
@@ -713,7 +713,7 @@ describe JsDuck::Aggregator do
    end

    it "inherits @protected" do
      @property[:meta][:protected].should == true
      @property[:protected].should == true
    end

    it "keeps @readonly" do
Loading