Loading lib/jsduck/doc_parser.rb +6 −2 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ module JsDuck skip_white end # matches @inheritdoc class.name#type-member # matches @inheritdoc class.name#static-type-member def at_inheritdoc match(/@inherit[dD]oc|@alias/) Loading @@ -342,7 +342,11 @@ module JsDuck @current_tag[:cls] = ident_chain if look(/#\w/) @input.scan(/#/) if look(/\w+-\w+/) if look(/static-/) @current_tag[:static] = true @input.scan(/static-/) end if look(/(cfg|property|method|event|css_var|css_mixin)-/) @current_tag[:type] = ident.to_sym @input.scan(/-/) end Loading lib/jsduck/inherit_doc.rb +2 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ module JsDuck warn("@inheritdoc #{inherit[:cls]}##{inherit[:member]} - class not found", context) return m end parent = parent_cls.get_members(inherit[:member], inherit[:type] || m[:tagname])[0] parent = parent_cls.get_members(inherit[:member], inherit[:type] || m[:tagname], inherit[:static] || m[:attributes][:static])[0] unless parent warn("@inheritdoc #{inherit[:cls]}##{inherit[:member]} - member not found", context) return m Loading @@ -53,7 +53,7 @@ module JsDuck warn("@inheritdoc - parent class not found", context) return m end parent = parent_cls.get_members(m[:name], m[:tagname])[0] parent = parent_cls.get_members(m[:name], m[:tagname], m[:attributes][:static])[0] unless parent warn("@inheritdoc - parent member not found", context) return m Loading spec/aggregator_inheritdoc_spec.rb +57 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,63 @@ describe JsDuck::Aggregator do it_behaves_like "@inheritdoc" end describe "@inheritdoc with staticality info" do before do @docs = parse(<<-EOF) /** @class Foo */ /** * @method bar * @static * Original comment. */ /** * @method bar * Method comment. */ /** @class Core */ /** * @method foobar * New comment. * @inheritdoc Foo#static-bar */ EOF @orig = @docs["Foo"][:statics][:method][0] @inheritdoc = @docs["Core"][:members][:method][0] end it_behaves_like "@inheritdoc" end describe "@inheritdoc without staticality info uses the statics of itself" do before do @docs = parse(<<-EOF) /** @class Foo */ /** * @method bar * @static * Original comment. */ /** * @method bar * Method comment. */ /** @class Core */ /** * @method foobar * @static * New comment. * @inheritdoc Foo#bar */ EOF @orig = @docs["Foo"][:statics][:method][0] @inheritdoc = @docs["Core"][:statics][:method][0] end it_behaves_like "@inheritdoc" end describe "recursive @inheritdocs" do before do @docs = parse(<<-EOF) Loading Loading
lib/jsduck/doc_parser.rb +6 −2 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ module JsDuck skip_white end # matches @inheritdoc class.name#type-member # matches @inheritdoc class.name#static-type-member def at_inheritdoc match(/@inherit[dD]oc|@alias/) Loading @@ -342,7 +342,11 @@ module JsDuck @current_tag[:cls] = ident_chain if look(/#\w/) @input.scan(/#/) if look(/\w+-\w+/) if look(/static-/) @current_tag[:static] = true @input.scan(/static-/) end if look(/(cfg|property|method|event|css_var|css_mixin)-/) @current_tag[:type] = ident.to_sym @input.scan(/-/) end Loading
lib/jsduck/inherit_doc.rb +2 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ module JsDuck warn("@inheritdoc #{inherit[:cls]}##{inherit[:member]} - class not found", context) return m end parent = parent_cls.get_members(inherit[:member], inherit[:type] || m[:tagname])[0] parent = parent_cls.get_members(inherit[:member], inherit[:type] || m[:tagname], inherit[:static] || m[:attributes][:static])[0] unless parent warn("@inheritdoc #{inherit[:cls]}##{inherit[:member]} - member not found", context) return m Loading @@ -53,7 +53,7 @@ module JsDuck warn("@inheritdoc - parent class not found", context) return m end parent = parent_cls.get_members(m[:name], m[:tagname])[0] parent = parent_cls.get_members(m[:name], m[:tagname], m[:attributes][:static])[0] unless parent warn("@inheritdoc - parent member not found", context) return m Loading
spec/aggregator_inheritdoc_spec.rb +57 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,63 @@ describe JsDuck::Aggregator do it_behaves_like "@inheritdoc" end describe "@inheritdoc with staticality info" do before do @docs = parse(<<-EOF) /** @class Foo */ /** * @method bar * @static * Original comment. */ /** * @method bar * Method comment. */ /** @class Core */ /** * @method foobar * New comment. * @inheritdoc Foo#static-bar */ EOF @orig = @docs["Foo"][:statics][:method][0] @inheritdoc = @docs["Core"][:members][:method][0] end it_behaves_like "@inheritdoc" end describe "@inheritdoc without staticality info uses the statics of itself" do before do @docs = parse(<<-EOF) /** @class Foo */ /** * @method bar * @static * Original comment. */ /** * @method bar * Method comment. */ /** @class Core */ /** * @method foobar * @static * New comment. * @inheritdoc Foo#bar */ EOF @orig = @docs["Foo"][:statics][:method][0] @inheritdoc = @docs["Core"][:statics][:method][0] end it_behaves_like "@inheritdoc" end describe "recursive @inheritdocs" do before do @docs = parse(<<-EOF) Loading