Skip to content

Commit 2028f99

Browse files
authored
Merge pull request #2355 from ksss/update-rdoc
Update rdoc to 6.13.1
2 parents 4e7b1dd + a9af5c1 commit 2028f99

File tree

15 files changed

+119
-47
lines changed

15 files changed

+119
-47
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ GEM
9595
rb-fsevent (0.11.2)
9696
rb-inotify (0.11.1)
9797
ffi (~> 1.0)
98-
rdoc (6.11.0)
98+
rdoc (6.13.1)
9999
psych (>= 4.0.0)
100100
regexp_parser (2.10.0)
101101
rspec (3.13.0)

lib/rbs/annotate/formatter.rb

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,10 @@ def format(newline_at_end:)
5959

6060
def self.each_part(doc, &block)
6161
if block
62-
document =
63-
case doc
64-
when String
65-
raise
66-
when RDoc::Comment
67-
document = doc.parse
68-
when RDoc::Markup::Document
69-
document = doc
70-
end
71-
72-
if document.file
73-
yield document
62+
if doc.file
63+
yield doc
7464
else
75-
document.each do |d|
65+
doc.each do |d|
7666
each_part(d, &block)
7767
end
7868
end

lib/rbs/annotate/rdoc_annotator.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def annotate_decls(decls, outer: [])
3939
def each_part(subjects, tester:)
4040
if block_given?
4141
subjects.each do |subject, docs|
42-
Formatter.each_part(subject.comment) do |doc|
42+
comment = subject.comment
43+
raise if comment.is_a?(String)
44+
Formatter.each_part(comment.parse) do |doc|
4345
if tester.test_path(doc.file || raise)
4446
yield [doc, subject]
4547
end

lib/rbs/annotate/rdoc_source.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def load
2323
@stores.clear()
2424

2525
RDoc::RI::Paths.each(with_system_dir, with_site_dir, with_home_dir, with_gems_dir ? :latest : false, *extra_dirs.map(&:to_s)) do |path, type|
26-
store = RDoc::Store.new(path, type)
26+
store = RDoc::Store.new(RDoc::Options.new, path:, type:)
2727
store.load_all
2828

2929
@stores << store

lib/rdoc/discover.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
begin
4-
gem 'rdoc', '~> 6.4'
4+
gem 'rdoc', '~> 6.13'
55
require 'rdoc_plugin/parser'
66
module RDoc
77
class Parser

lib/rdoc_plugin/parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def parse_method_decl(decl:, context:, outer_name: nil)
8686
end
8787

8888
def parse_method_alias_decl(decl:, context:, outer_name: nil)
89-
alias_def = RDoc::Alias.new(nil, decl.old_name.to_s, decl.new_name.to_s, nil, decl.kind == :singleton)
89+
alias_def = RDoc::Alias.new(nil, decl.old_name.to_s, decl.new_name.to_s, nil, singleton: decl.kind == :singleton)
9090
alias_def.comment = construct_comment(context: context, comment: comment_string(decl)) if decl.comment
9191
context.add_alias(alias_def)
9292
end
@@ -100,7 +100,7 @@ def parse_attr_decl(decl:, context:, outer_name: nil)
100100
when ::RBS::AST::Members::AttrAccessor
101101
'RW'
102102
end
103-
attribute = RDoc::Attr.new(nil, decl.name.to_s, rw, nil, decl.kind == :singleton)
103+
attribute = RDoc::Attr.new(nil, decl.name.to_s, rw, nil, singleton: decl.kind == :singleton)
104104
attribute.visibility = decl.visibility
105105
attribute.comment = construct_comment(context: context, comment: comment_string(decl)) if decl.comment
106106
context.add_attribute(attribute)

sig/annotate/formatter.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module RBS
1717

1818
def self.translate: (RDoc::Markup::Document) -> String?
1919

20-
def self.each_part: (RDoc::Markup::Document | RDoc::Comment | String) { (RDoc::Markup::Document) -> void } -> void
21-
| (RDoc::Markup::Document | RDoc::Comment | String) -> Enumerator[RDoc::Markup::Document, void]
20+
def self.each_part: (RDoc::Markup::Document) { (RDoc::Markup::Document) -> void } -> void
21+
| (RDoc::Markup::Document) -> Enumerator[RDoc::Markup::Document, void]
2222
end
2323
end
2424
end

sig/annotate/rdoc_annotater.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module RBS
1717
end
1818

1919
interface _WithRDocComment
20-
def comment: () -> (RDoc::Markup::Document | RDoc::Comment | String)
20+
def comment: () -> (RDoc::Comment | String)
2121
end
2222

2323
def each_part: (Array[Object & _WithRDocComment], tester: _PathTester) { ([RDoc::Markup::Document, Object & _WithRDocComment]) -> void } -> void

stdlib/rdoc/0/code_object.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module RDoc
3030
# <!-- rdoc-file=lib/rdoc/code_object.rb -->
3131
# Our comment
3232
#
33-
attr_reader comment: Markup::Document | Comment | String
33+
attr_reader comment: Comment | String
3434

3535
# <!--
3636
# rdoc-file=lib/rdoc/code_object.rb
@@ -46,6 +46,6 @@ module RDoc
4646
# -->
4747
# Replaces our comment with `comment`, unless it is empty.
4848
#
49-
def comment=: (Markup::Document | Comment | String | nil) -> (Markup::Document | Comment | String)
49+
def comment=: (Comment | String | nil) -> (Comment | String | nil)
5050
end
5151
end

stdlib/rdoc/0/comment.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module RDoc
2020
#
2121
attr_accessor location: String
2222

23+
alias file location
24+
2325
# <!--
2426
# rdoc-file=lib/rdoc/comment.rb
2527
# - new(text = nil, location = nil, language = nil)

0 commit comments

Comments
 (0)