Skip to content

Commit 2973d9d

Browse files
committed
Support :nodoc: on method definition parameter end line
1 parent 0299ae1 commit 2973d9d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/rdoc/parser/prism_ruby.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def add_extends(names, line_no) # :nodoc:
510510

511511
# Adds a method defined by `def` syntax
512512

513-
def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singleton:, params:, calls_super:, block_params:, tokens:, start_line:, end_line:)
513+
def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singleton:, params:, calls_super:, block_params:, tokens:, start_line:, args_end_line:, end_line:)
514514
return if @in_proc_block
515515

516516
receiver = receiver_name ? find_or_create_module_path(receiver_name, receiver_fallback_type) : @container
@@ -524,6 +524,7 @@ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singl
524524
meth.comment = comment
525525
end
526526
handle_modifier_directive(meth, start_line)
527+
handle_modifier_directive(meth, args_end_line)
527528
handle_modifier_directive(meth, end_line)
528529
return unless should_document?(meth)
529530

@@ -854,6 +855,7 @@ def visit_singleton_class_node(node)
854855

855856
def visit_def_node(node)
856857
start_line = node.location.start_line
858+
args_end_line = node.parameters&.location&.end_line || start_line
857859
end_line = node.location.end_line
858860
@scanner.process_comments_until(start_line - 1)
859861

@@ -904,6 +906,7 @@ def visit_def_node(node)
904906
calls_super: calls_super,
905907
tokens: tokens,
906908
start_line: start_line,
909+
args_end_line: args_end_line,
907910
end_line: end_line
908911
)
909912
ensure

test/rdoc/test_rdoc_parser_prism_ruby.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,12 @@ def nodoc2 # :nodoc:
13911391
def doc3; end
13921392
def nodoc3
13931393
end # :nodoc:
1394+
def nodoc4(arg1,
1395+
arg2) # :nodoc:
1396+
end
13941397
def doc4; end
13951398
# :stopdoc:
1396-
def nodoc4; end
1399+
def nodoc5; end
13971400
end
13981401
RUBY
13991402
klass = @store.find_class_named 'Foo'

0 commit comments

Comments
 (0)